Jump to content

Recommended Posts

Anyone have code to do this?

 

I found this code, but for some reason it's not getting/submitting the form properly

 

Set IE = CreateObject("InternetExplorer.Application")
set WshShell = WScript.CreateObject("WScript.Shell")
IE.Navigate "http://www.somewebsite.com/form.php"
IE.Visible = True
Wscript.Sleep 2000
call IE.Document.Forms(3).Submit()

 

It is the 4th form on the page, but i get the following error:

Object doesn't support this property or method 'IE.Document.Forms(...).Submit'

 

Any ideas?

Link to comment
https://forums.phpfreaks.com/topic/215452-vbscript-open-webpage-submit-form-close/
Share on other sites

got it to work now. Not sure why but I had to make a slight change to the last line of code in order for the form to be submitted properly:

 

call IE.Document.Forms("formName").elements("Submit").click

 

Now all I need to figure out how to close the IE window after it's done. How do I do that?

ok, sorry for bugging you guys. I figured out how to close the IE window after it was finished. Here's the final code:

 

'Create IE obect
Set IE = CreateObject("InternetExplorer.Application")
set WshShell = WScript.CreateObject("WScript.Shell")

'Go to webstie
IE.Navigate "http://www.somewebsite.com/form.php"
IE.Visible = True
Wscript.Sleep 2000

'Submit form
call IE.Document.Forms("formName").elements("Submit").click
Wscript.Sleep 2000

'Close IE
objIE.Quit
Set objIE = Nothing

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.