Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default Excel VBA to click 'submit' on form

Hi Nixter,

Instead of navigating to the URL, filling in form values, and then
attempting to submit the form or click a button, you may want to try the
XMLHTTP object. Here's a link to an example:

http://groups.google.com/group/micro...829784b4ad0c6b

With this method you are directly posting data to the URL specified in the
action attribute of the form element (in this case, it's blank, which means
it posts to itself). You may have to modify the form on the server to
include id or name attributes for the input elements, as that's how you can
refer to them when posting.

If you want to continue down the same path, you could name the form element,
then use something like this in your code:

.Document.GetElementById("myform").Submit

--
Regards,

Jake Marx
www.longhead.com


[please keep replies in the newsgroup - email address unmonitored]


Nixter wrote:
I am scripting the input to an intranet website and am getting stuck
at the clicking submit button - despite trrying code samples from
other posts and boards...

essentially I am taking the value in cell A1, defining it as
"base_url", and navigating to that page. The script pulls in the IE
page, waits for the load, the password is entered successfully, and
there's where it all ends where I am trying to have a 'submit' event
happen to the submit button. The button is not named and everything
runs fine up to the point of button click. Password values pass thru
no problem as when I manually click the button it navigates to the
next page...

I have tried, among other things in the code below:
.submit
.click

Sendkeys sequences
End With
.Visible = True
SendKeys "{TAB}", True
SendKeys "~", True


The text in the code:

input type=text name='orderID' value='370732'

is passed from the server upon URL navigation...
Still nothing. I am racking my brain - there's no reason I can think
of for this not to work. The "Click Submit" bolded below is where it
hangs...

Thanks MUCH!

Coding below



code from the server:
--------------------------------------------------------------------------------
<FORM ACTION='' method='POST'
<table<tr
<td<bEnter The Server Password: </b</td
<td align=left<input type='password' name='password'</td</tr
<tr
<td<bEnter The Filename</b</td
<td align=left<input type=text name='orderID'
value='370732'</td</tr <tr<td</td<td align=center<input
type='Submit' value='Submit' </td</tr</table
</FORM
</body
</html
--------------------------------------------------------------------------------


--- VB Script ---

Sub process_item()

Sheets("input").Select

base_url = Cells(1, 1).Value


Range("A1").Select

Dim url As String

url = base_url

Dim ie As Object
'Dim document As Object
Set ie = CreateObject("internetexplorer.application")
With ie
.Visible = True
.Navigate base_url
Do While .ReadyState < 4
DoEvents
Loop

With .document.all
.Password.Value = "password123"
(This is where I hang up)
-- CLICK SUBMIT <--



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
Macro to automatically fill and submit (in batch) an online form fromdata in a excel sheet??? Christophe[_2_] Excel Discussion (Misc queries) 0 December 20th 07 07:57 AM
saveto or Submit Form functionality in Excel MLyons10 Excel Worksheet Functions 0 March 29th 06 05:47 PM
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
I wanta infopath form to submit data to an excel databse file uCHE Excel Discussion (Misc queries) 0 April 26th 05 05:56 PM


All times are GMT +1. The time now is 12:07 PM.

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

About Us

"It's about Microsoft Excel"