Automated Web Form throught Excel
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
|