I have designed the IE_Automation Macro in the attached Excel file. It works fine in loading data to http://www.kgs.ku.edu/Magellan/Field/index.html but I could not figure out the code to click either select by Name or Select by T-R-S buttons to submit the data as always it clicks Select By Reservoir Name button Also I need to copy the Location of the resulting web page (Location) and paste it in Cells(N,10)
Hi Mourad,
Here is the code for that part:
' Problem is in following 4 steps
If objCollection(i).Type = "submit" And objCollection(i).Value = "Select by Name" Then
Set objElement = objCollection(i)
End If
i = i + 1
Wend
objElement.Click
' Wait while IE re-loading...
Do While IE.Busy
Application.Wait DateAdd("s", 1, Now)
Loop
Debug.Print IE.LocationURL
objCollection(i).Value = "Select By Name" is wrong, in your page is objCollection(i).Value = "Select by Name", that's why the object is not set properly.
Note that objElement.Click is outside the loop now, otherwise it will click all over the place.
You can get the browser address with:
Cells(1,"N")=IE.LocationURL (change the cell address as needed)
For the radio button, Whole Name is checked by default, so no need to check it in code.
If you want to select that radion button option, use:
objCollection(i).Checked = True