hi all,
I am trying to create a macro that will import data from a web page as specified on the worksheet (so that I can change where it imports data each time), but at the moment I can only get it to look up one specific web page.
Here's what I've got so far:
Sub Macro1()
'
' Macro1 Macro
' Macro recorded 03/03/2005 by SwapitShop
'
' Keyboard Shortcut: Ctrl+w
'
Range("Q3").Select
Selection.Copy
Range("Q5").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = _
"http://www.swapitshop.com/cgi-bin/swapitshop/browse.cgi?detailed_view=1&swap_id=565591&full_details=565591&action=view"
Range("Q6").Select
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://www.swapitshop.com/cgi-bin/swapitshop/browse.cgi?detailed_view=1&swap_id=565591&full_details=565591&action=view" _
, Destination:=Range("C8"))
.Name = _
"browse.cgi?detailed_view=1&swap_id=565591&full_details=565591&action=view"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingNone
.WebTables = "17,21"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
ActiveWindow.SmallScroll Down:=-9
End Sub
Sub Macro2()
'
' Macro2 Macro
' Macro recorded 03/03/2005 by SwapitShop
'
' Keyboard Shortcut: Ctrl+t
'
Range("C8:E250").Select
Selection.ClearContents
ActiveWindow.SmallScroll Down:=-12
Range("C8").Select
End Sub
Please note all the web pages I am trying to query have exactly the same layout just different content.
thanks for your help
Leon
Bookmarks