Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 190
Default submit web form

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default submit web form

Difficult to suggest what to try without seeing the HTML source of the page.

Tim

"geebee" (noSPAMs) wrote in message
...
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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
form submit geebee Excel Programming 2 July 22nd 08 12:30 AM
Excel VBA to click 'submit' on form Nixter Excel Programming 1 October 13th 05 12:20 AM
Form Input--Submit evangray123 Excel Programming 3 June 16th 05 11:34 PM
Form with submit button Hooter Excel Worksheet Functions 0 June 8th 05 07:12 PM
Submit User Form Contents to next available row jonathan Excel Programming 3 January 25th 04 07:17 PM


All times are GMT +1. The time now is 08:00 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"