G
geebee
hi,
i have the following. i was able to fill the fields in, but i just cant get
the code to simulate clicking the "OK" button to submit the form...
'This project includes references to "Microsoft Internet Controls" and
'"Microsoft HTML Object Library"
'Variable declarations
Dim myIE As New InternetExplorer 'New '
Dim myURL As String
Dim myDoc As HTMLDocument
Dim strSearch As String
'Set starting URL and search string
myURL = "https://cantsay.com/Transactions/Logon.asp"
strSearch = "me"
'Make IE navigate to the URL and make browser visible
myIE.navigate myURL
myIE.Visible = True
'Wait for the page to load
Do While myIE.Busy Or myIE.readyState <> READYSTATE_COMPLETE
DoEvents
Loop
'Set IE document into object
Set myDoc = myIE.document
'Enter search string on form
Dim strpassword As String
strpassword = "mine"
With myDoc.getElementsByName("UserName")(0)
..Value = strSearch
End With
With myDoc.getElementsByName("Password")(0)
..Value = strpassword
End With
With myDoc.getElementsByName("Client")(0)
..Value = "TEST"
End With
'Submit form
'myDoc.getElementsByName("Client")(0).OK.submit
'myDoc.forms(0).submit
'myDoc.forms("Logon").submit
'Set sform = myDoc.forms(0)
'sform.submit
'Set formbutton = myDoc.getElementsByName("btnSubmit")
'formbutton.Click
Windows.Application.SendKeys "{ENTER}"
SendKeys (strIn)
SendKeys "{ENTER}"
....
any help would great be appreciated!!!
thanks in advance,
geebee
i have the following. i was able to fill the fields in, but i just cant get
the code to simulate clicking the "OK" button to submit the form...
'This project includes references to "Microsoft Internet Controls" and
'"Microsoft HTML Object Library"
'Variable declarations
Dim myIE As New InternetExplorer 'New '
Dim myURL As String
Dim myDoc As HTMLDocument
Dim strSearch As String
'Set starting URL and search string
myURL = "https://cantsay.com/Transactions/Logon.asp"
strSearch = "me"
'Make IE navigate to the URL and make browser visible
myIE.navigate myURL
myIE.Visible = True
'Wait for the page to load
Do While myIE.Busy Or myIE.readyState <> READYSTATE_COMPLETE
DoEvents
Loop
'Set IE document into object
Set myDoc = myIE.document
'Enter search string on form
Dim strpassword As String
strpassword = "mine"
With myDoc.getElementsByName("UserName")(0)
..Value = strSearch
End With
With myDoc.getElementsByName("Password")(0)
..Value = strpassword
End With
With myDoc.getElementsByName("Client")(0)
..Value = "TEST"
End With
'Submit form
'myDoc.getElementsByName("Client")(0).OK.submit
'myDoc.forms(0).submit
'myDoc.forms("Logon").submit
'Set sform = myDoc.forms(0)
'sform.submit
'Set formbutton = myDoc.getElementsByName("btnSubmit")
'formbutton.Click
Windows.Application.SendKeys "{ENTER}"
SendKeys (strIn)
SendKeys "{ENTER}"
....
any help would great be appreciated!!!
thanks in advance,
geebee