B
Bobbo
I am trying to use a macro that will prompt for a web address then store that
address in a querytable. What I have so far is below. The prompt works but It
errors out when you select OK on the inputbox. If I comment out myRange and
just hardcode the address it will work. Any suggestions
Thanks
Bob
Set myRange = Application.InputBox(prompt:="Web Address", Type:=2)
With ActiveSheet.QueryTables.Add(Connection:=myRange,
Destination:=Range("$A$1"))
.Name = _
""
.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 = "68"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
address in a querytable. What I have so far is below. The prompt works but It
errors out when you select OK on the inputbox. If I comment out myRange and
just hardcode the address it will work. Any suggestions
Thanks
Bob
Set myRange = Application.InputBox(prompt:="Web Address", Type:=2)
With ActiveSheet.QueryTables.Add(Connection:=myRange,
Destination:=Range("$A$1"))
.Name = _
""
.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 = "68"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With