Chacanger
Programmer
- Feb 22, 2011
- 7
Hi
Recently I was querying about how to automate certian things in Internet Explorer on this site, I have read up about it since and thought about this...
Is there was a way to use the VBkeyReturn to actually press enter in an Input Box rather than the ASCCI Number or if there was a way to use API call to press enter in an Input box, basically I want to use it in this example below but I'm not allowed to use the Buttons on the website as this is a test version of something with no buttons.
I have used SendKeys but they have a low success rate and I really mustn't use them for my code.
I would also need to get something to prevent the code going to fast, I used Sleep which works well, but sometimes the sleeps need to vary in time so I wondered can you get something to detect when the web page is ok to continue with the code.
This is the code which also uses the Internet Controls Reference, also you would need to disable the "Instant On" feature on the Google page...
VBA:
Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Sub Auto()
Dim ie As InternetExplorer
Set ie = New InternetExplorer
ie.Navigate
Do Until ie.ReadyState = READYSTATE_COMPLETE
Loop
ie.Document.all("q").Value = "Chacanger"
SendKeys "ENTER", True
Sleep 200
ie.Document.all("q").Value = "Random Text"
SendKeys "ENTER", True
Sleep 200
ie.Document.all("q").Value = "More Random Text"
SendKeys "ENTER", True
Sleep 200
ie.Document.all("q").Value = "Another Random Text"
SendKeys "ENTER", True
Sleep 200
ie.Quit
Set ie = Nothing
End Sub
Thanks in advance for any help
Recently I was querying about how to automate certian things in Internet Explorer on this site, I have read up about it since and thought about this...
Is there was a way to use the VBkeyReturn to actually press enter in an Input Box rather than the ASCCI Number or if there was a way to use API call to press enter in an Input box, basically I want to use it in this example below but I'm not allowed to use the Buttons on the website as this is a test version of something with no buttons.
I have used SendKeys but they have a low success rate and I really mustn't use them for my code.
I would also need to get something to prevent the code going to fast, I used Sleep which works well, but sometimes the sleeps need to vary in time so I wondered can you get something to detect when the web page is ok to continue with the code.
This is the code which also uses the Internet Controls Reference, also you would need to disable the "Instant On" feature on the Google page...
VBA:
Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Sub Auto()
Dim ie As InternetExplorer
Set ie = New InternetExplorer
ie.Navigate
Do Until ie.ReadyState = READYSTATE_COMPLETE
Loop
ie.Document.all("q").Value = "Chacanger"
SendKeys "ENTER", True
Sleep 200
ie.Document.all("q").Value = "Random Text"
SendKeys "ENTER", True
Sleep 200
ie.Document.all("q").Value = "More Random Text"
SendKeys "ENTER", True
Sleep 200
ie.Document.all("q").Value = "Another Random Text"
SendKeys "ENTER", True
Sleep 200
ie.Quit
Set ie = Nothing
End Sub
Thanks in advance for any help