I'm using web queries in excel.
The following is the code I use to gather the info from "[ignore][/ignore]"
If I have a button on the sheet called "List", and call the above code, I get:
I have created a macro, using Excel's built in writer, and this is the code it provides, which works fine!
Any help would be greatly appreciated.
Aubs
The following is the code I use to gather the info from "[ignore][/ignore]"
Code:
ActiveWorkbook.Sheets.Add After:=Worksheets(Worksheets.Count)
ActiveWorkbook.ActiveSheet.Name = "Data Collection"
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;[URL unfurl="true"]http://somewebaddress/MyInfo?Aubs"[/URL] _
, Destination:=Range("A1"))
.Name = "MyInfo?Aubs"
.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 = "1"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
ActiveWorkbook.Sheets("List").Select
If I have a button on the sheet called "List", and call the above code, I get:
Code:
Run-time error '-2147024809 (80070057)':
The destination range is not on the same worksheet that the query table is being created on.
I have created a macro, using Excel's built in writer, and this is the code it provides, which works fine!
Code:
Sub Macro1()
'
' Macro1 Macro
' Macro recorded 25/11/2003 by Aubs
'
'
ActiveWorkbook.Worksheets.Add
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;[URL unfurl="true"]http://setiathome2.ssl.berkeley.edu/fcgi-bin/fcgi?email=test@test.com&cmd=user_stats_new"[/URL] _
, Destination:=Range("A1"))
.Name = "fcgi?email=test@test.com&cmd=user_stats_new"
.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 = "1"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
End Sub
Any help would be greatly appreciated.
Aubs