DonGarry
asked on
Connecting to Popup Web Page using VBA
Hello Experts, we are trying to automate connecting to a website, logging in and performing certain tasks using VBA. All is working well till we get to a particular submit button that when clicked on manually brings up a popup webpage.
The code below shows the IE source code and snippets of what we are doing in VBA. Any assistance here would be greatly appreciated.
The code below shows the IE source code and snippets of what we are doing in VBA. Any assistance here would be greatly appreciated.
'Here is what part of the IE source code of the submit button looks like:
<td>
<input type="submit" name="_ctl7:_ctl4:btnMemberLookup" value="Select Players For Ballot" onclick="return btnMemberLookup_onclick();if (typeof(Page_ClientValidate) == 'function') Page_ClientValidate(); " language="javascript" id="_ctl7__ctl4_btnMemberLookup" style="width:170px;" />
</td>
'Here is how we are connecting to the URL:
strURL = "the location of the webpage we are trying to automate"
' Create an object of type InternetExplorer
Set objIE = CreateObject("InternetExplorer.Application")
' Use the Navigate method to make our IE object visit a web page (strURL=Your web page)
objIE.navigate strURL
' Make the InternetExplorer window visible objIE.Visible = True
'We are not having any problems doing other things on the form such as clicking on the following button:
'Click on View/Add Ballot
objIE.Document.all("_ctl7:_ctl4:btnViewBallot:imgbtn").Click
While objIE.ReadyState <> 4 Or objIE.Busy = True
DoEvents
Wend
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'However when we try to use VBA o the Member Lookup button it fails. We tried .submit and it doesn't work either.
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
objIE.Document.all("ctl7:_ctl4:btnMemberLookup").Click
While objIE.ReadyState <> 4 Or objIE.Busy = True
DoEvents
Wend
ASKER
Hello boag2000:
Thanks for you reply....
I've looked at your links and still cannot find a solutions.
Here is what I have tried and still no luck:
objIE.Document.all("ctl7:_ ctl4:btnMe mberLookup ").Click
objIE.Document.all("_ctl7_ _ctl4_btnM emberLooku p").Submit
objIE.Document.Form("_ctl7 __ctl4_btn MemberLook up").Click
objIE.Document.Form("ctl7: _ctl4:btnM emberLooku p").Submit
I'm getting the error: object doesn't support this property or method (438)
Any other suggestions?
Thanks for you reply....
I've looked at your links and still cannot find a solutions.
Here is what I have tried and still no luck:
objIE.Document.all("ctl7:_
objIE.Document.all("_ctl7_
objIE.Document.Form("_ctl7
objIE.Document.Form("ctl7:
I'm getting the error: object doesn't support this property or method (438)
Any other suggestions?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Yes I do as a matter of fact...and I've looked at the syntax 100 times at least and am not spotting anything obvious....hmmmm
Remember that some of those links presume that you are using a webbrowser control...
Are you?
Are you?
ASKER
Well as it turns out you were right! It was a syntax problem...I guess I'm going blind.
The correct syntax to open up the popup window is indeed:
objIE.Document.all("_ctl7: _ctl4:btnM emberLooku p").Click
(I was missing an underscore)
Thanks for the help!
The correct syntax to open up the popup window is indeed:
objIE.Document.all("_ctl7:
(I was missing an underscore)
Thanks for the help!
;-)
https://www.experts-exchange.com/questions/23373946/How-programmatically-click-on-a-button-on-a-webpage.html
https://www.experts-exchange.com/questions/20511039/Automating-Clicking-a-Submit-Button-on-a-Web-Page.html
https://www.experts-exchange.com/questions/23865627/clicking-a-button-to-enter-website.html