Automated Web Form throught Excel

G

Guest

I visit multiple websites each week posting updated data that I save in
an excel 2003 spreadsheet. I would like to automate this process to
save time but I have struggled as I am not proficent writing code.

I am a novice with a variety of experience. Mostly adapting
similar code. I have been directed to multiple places with no luck so
I am posting again to see if anyone can help.

I need to enter saved data from my speadsheet into
the fields of a web form. Then, submit the form.

I have all of the data for the forms stored in a spreadsheet.
If you could help with an example using,
http://www.mapquest.com/maps/main.adp entering data
and clicking submit.

Thank you in advance for your help!
 
A

anon

I did a similar thing a while back and tried lots of different ways
with varying success.

The simple (but not always successful way - you may get variable
results) is to use send keys

So you would navigate to the web page, your code would then "press"
the tab key until the correct form box was selected (eg. address).
Then your code would copy the value from your excel sheet into the
form box. You could repreat this for a couple of boxes and then your
code would "press" enter to submit the form to the web page.

The alternative is to view the source code of the web page and get the
names of the form boxes (click View and then source on the menus
whilst on the page). I believe you can then set the values of these
boxes with your code, and submit using send keys.
 
S

Sean

Bryan

Whay you need to do is firstly create a Data Link to your required web
site, pulling it back to a sheet, then just refresh the data via your
code each time you require to run it.

Data - Import External Data - New Web Query: Just navigate to your
site and select the relevant data

The code below refreshes a number of these Web queries, just change
sheet name and range to suit, it also does a couple of other things
like hiding sheets which you won't want, again change to suit

Sub GetLatestPrices()


Application.ScreenUpdating = False

Sheets("Web Prices").Activate
ActiveSheet.Visible = True
Range("A1").Select
Selection.QueryTable.Refresh BackgroundQuery:=False

Range("I1").Select
Selection.QueryTable.Refresh BackgroundQuery:=False

Range("Q1").Select
Selection.QueryTable.Refresh BackgroundQuery:=False

Range("T1").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
Range("A1").Select

ActiveSheet.Visible = xlVeryHidden

Sheets("Current Prices").Select

Range("H27:I27").Select
Selection.Copy
Range("F27:G27").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False

Application.CutCopyMode = False

Range("A1").Select

Sheets("Web Prices").Activate
ActiveSheet.Visible = xlVeryHidden

Sheets("Current Prices").Activate
Range("A1").Select

Application.ScreenUpdating = True

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top