View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
rbarning[_2_] rbarning[_2_] is offline
external usenet poster
 
Posts: 1
Default dynamic web queries with vba


Yes I did.
You can name the url as a parameter, I called it x.
I did the range by multiplying the for next loop number by 200.
I'm sure it is not the best code, but it works pretty good.

Sub aaa()

Dim x As String
Dim webq As Integer

For webq = 1 To range("F1")

x = range("D" & webq)

With ActiveSheet.QueryTables.Add(Connection:= _
"URL;" & x, _
Destination:=range("C" & webq * 200))
.Name = "gamelog?playerId=4234"
.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,5"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With



application.CutCopyMode = False

Next webq

End Sub



Pelham Wrote:
Dear Randy

Did you ever solve this problem?

I am trying to do the same thing with about 200 different web page
and
am curious to know what your VBA script looks to do your action.

Regards
Pelha


--
rbarnin
-----------------------------------------------------------------------
rbarning's Profile: http://www.excelforum.com/member.php...fo&userid=3778
View this thread: http://www.excelforum.com/showthread.php?threadid=57354