Hi Guys,
As always I've tried and died on this one so many times...
( START ESSAY )
I'm trying to send keys to a WebBrowser control within my program that is connected to an external website.
I can get the start of the procedure to work (shakily, but working.) However it seems to not want to carry on after I reach a certain point.
Basically, the page in question is a Submission page for hotel guest info, and I want to automatically send the file required. Here's the annotated code:
OK, now it fails AFTER it opens the Second Page, i.e.
'OPEN Send Page for File Entry
WebBrowser1.Navigate sHotelSendPage
It actually reaches that page, but will then not send any of the following keystrokes (TAB's etc.)
This is doing my nut in, so to speak, and I need to resolve it. Is there a BETTER method of doing this?
I've looked into the Sendmessage API, but this only week for physical controls? (i.e. not ones contained within the browser control)
Or if there is no better method, Is there a way to fix the problem?
Many thanks in advance, and sorry for the essay!!!
Jag
[tt]'Very funny, Scotty... Now Beam down my clothes.'[/tt]
As always I've tried and died on this one so many times...
( START ESSAY )
I'm trying to send keys to a WebBrowser control within my program that is connected to an external website.
I can get the start of the procedure to work (shakily, but working.) However it seems to not want to carry on after I reach a certain point.
Basically, the page in question is a Submission page for hotel guest info, and I want to automatically send the file required. Here's the annotated code:
Code:
Private Sub Command1_Click()
Dim x As Integer
'Open Logon page of Website
WebBrowser1.Navigate sHotelLogOnPage
'Wait for Browser
Do While WebBrowser1.Busy = True
DoEvents
Loop
WebBrowser1.SetFocus
'Wait for Browser
Do While WebBrowser1.Busy = True
DoEvents
Loop
'Send ENTER Key to Enter Site
SendKeys "{ENTER}", True
WebBrowser1.SetFocus
'Wait for Browser
Do While WebBrowser1.Busy = True
DoEvents
Loop
WebBrowser1.SetFocus
'Send TAB to Activate Page,
'SHIFT+TAB to back up to Logon Box
'USERNAME of User
'TAB to Password Box
'PASSWORD of User
SendKeys "{TAB}"
SendKeys "+{TAB}"
SendKeys sHotelUserName
SendKeys "{TAB}"
SendKeys sHotelPassword
'Send Three Tabs to Reach SUBMIT Button
For x = 1 To 3
SendKeys "{TAB}", True
Next x
'SPACE Key to Activate Submit Button
SendKeys " ", True
'Wait for Browser
Do While WebBrowser1.Busy = True
DoEvents
Loop
'OPEN Send Page for File Entry
WebBrowser1.Navigate sHotelSendPage
'Wait for Browser
Do While WebBrowser1.Busy = True
DoEvents
Loop
WebBrowser1.SetFocus
'Wait for Browser
Do While WebBrowser1.Busy = True
DoEvents
Loop
'Send SEVEN Tabs to Reach Filename textbox
For x = 1 To 7
SendKeys "{TAB}", True
Next x
'Send Filename
SendKeys sGuestFileName
'Send THREE Tabs to Reach SUBMIT Button
For x = 1 To 3
SendKeys "{TAB}", True
Next x
'Send SPACE to activate submit button.
SendKeys " "
End Sub
OK, now it fails AFTER it opens the Second Page, i.e.
'OPEN Send Page for File Entry
WebBrowser1.Navigate sHotelSendPage
It actually reaches that page, but will then not send any of the following keystrokes (TAB's etc.)
This is doing my nut in, so to speak, and I need to resolve it. Is there a BETTER method of doing this?
I've looked into the Sendmessage API, but this only week for physical controls? (i.e. not ones contained within the browser control)
Or if there is no better method, Is there a way to fix the problem?
Many thanks in advance, and sorry for the essay!!!
Jag
[tt]'Very funny, Scotty... Now Beam down my clothes.'[/tt]