Ethen5155
02-02-2017, 04:27 AM
Hi all,
kindly i need some help about my below code to get data from web, i want to make it go through multiple ID number and get data
for ex,
the web link is: http://www.vbaexpress.com/kb/getarticle.php?kb_id=50
i want it to get through id=50 to be like from 50 to 1000
http://www.vbaexpress.com/kb/getarticle.php?kb_id=51
http://www.vbaexpress.com/kb/getarticle.php?kb_id=52
http://www.vbaexpress.com/kb/getarticle.php?kb_id=53
http://www.vbaexpress.com/kb/getarticle.php?kb_id=54
http://www.vbaexpress.com/kb/getarticle.php?kb_id=55
http://www.vbaexpress.com/kb/getarticle.php?kb_id=999
.........etc
my code:
Sub FetchData()
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://www.vbaexpress.com/kb/getarticle.php?kb_id=50", Destination:=Range( _
"$A$1"))
.Name = "Test"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlEntirePage
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
End Sub
Thanks in advance
cheers
Ethen
Cross-Posting: http://www.excelforum.com/showthread.php?t=1172313&p=4574042#post4574042
kindly i need some help about my below code to get data from web, i want to make it go through multiple ID number and get data
for ex,
the web link is: http://www.vbaexpress.com/kb/getarticle.php?kb_id=50
i want it to get through id=50 to be like from 50 to 1000
http://www.vbaexpress.com/kb/getarticle.php?kb_id=51
http://www.vbaexpress.com/kb/getarticle.php?kb_id=52
http://www.vbaexpress.com/kb/getarticle.php?kb_id=53
http://www.vbaexpress.com/kb/getarticle.php?kb_id=54
http://www.vbaexpress.com/kb/getarticle.php?kb_id=55
http://www.vbaexpress.com/kb/getarticle.php?kb_id=999
.........etc
my code:
Sub FetchData()
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://www.vbaexpress.com/kb/getarticle.php?kb_id=50", Destination:=Range( _
"$A$1"))
.Name = "Test"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlEntirePage
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
End Sub
Thanks in advance
cheers
Ethen
Cross-Posting: http://www.excelforum.com/showthread.php?t=1172313&p=4574042#post4574042