Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 50228

VBA/Macro to query specific data on webpage

$
0
0
Hi I have some code that I got out of these forums. I want to grab only a little bit of info off of 47 steam profiles. I am not sure how to determine table numbers for the data I want. I am atttaching a screenshot of the data I want to retrieve with red boxes around it. I used the following code and tried tables 1 to 20 and retrieved nothing so I tried xlEntirePage and got all the data which I don't want. I'm trying to build a macro that gathers the data fast and that's too much data for one Steam Profile when I have 47 to do. It takes anywhere from 11 to 18 seconds to gather the data for one profile using xlEntirePage. Eventually I want to data to go on sperate member named sheets that are already created. I want to be able to activate the macro on my cover sheet via button which will not be the active sheet. I disabled the webtables after trying 1 to 20.

Code:

Sub All_Steam_Profiles()
  Dim sTS As String
 
  sTS = Range("a1").Value
  With ActiveSheet.QueryTables.Add(Connection:= _
      "URL;http://steamcommunity.com/profiles/76561198026912226/" _
        & sTS, Destination:=Range("A3"))
      .Name = "finance?fstype=ii&q=" & sTS
      .FieldNames = True
      .RowNumbers = False
      .FillAdjacentFormulas = False
      .PreserveFormatting = True
      .RefreshOnFileOpen = False
      .BackgroundQuery = True
      .RefreshStyle = xlOverwriteCells
      .SavePassword = False
      .SaveData = True
      .AdjustColumnWidth = True
      .RefreshPeriod = 0
      .WebSelectionType = xlEntirePage
      .WebFormatting = xlWebFormattingNone
      '.WebTables = ""
      .WebPreFormattedTextToColumns = True
      .WebConsecutiveDelimitersAsOne = True
      .WebSingleBlockTextImport = False
      .WebDisableDateRecognition = False
      .WebDisableRedirections = False
      .Refresh BackgroundQuery:=False
  End With
End Sub


Stats.jpg

ManagerTool - Copy.xlsm

Viewing all articles
Browse latest Browse all 50228

Trending Articles