Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Connecting to Popup Web Page using VBA

Posted on 2010-11-13
7
Medium Priority
?
610 Views
Last Modified: 2012-05-10
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.
'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

Open in new window

0
Comment
Question by:DonGarry
  • 4
  • 3
7 Comments
 

Author Comment

by:DonGarry
ID: 34151556
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:btnMemberLookup").Click
objIE.Document.all("_ctl7__ctl4_btnMemberLookup").Submit
objIE.Document.Form("_ctl7__ctl4_btnMemberLookup").Click
objIE.Document.Form("ctl7:_ctl4:btnMemberLookup").Submit

I'm getting the error: object doesn't support this property or method (438)

Any other suggestions?
0
 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 1500 total points
ID: 34151616
That error, most likely, has to do with code syntax.

You get this error on all of the examples you posted?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:DonGarry
ID: 34151670
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
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 34152412
Remember that some of those links presume that you are using a webbrowser control...
Are you?
0
 

Author Closing Comment

by:DonGarry
ID: 34161058
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:btnMemberLookup").Click
(I was missing an underscore)

Thanks for the help!
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 34161541
;-)
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
In a use case, a user needs to close an opened report by simply pressing the Escape (Esc) key. This can be done by adding macro code in Report_KeyPress or Report_KeyDown event.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

877 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question