Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Import External Data/Web Query on Javascript data w/VBA?

Status
Not open for further replies.

rlee16

Technical User
Jan 19, 2003
44
0
0
HK
I had been querying stock/financial data from Yahoo (non US) but it has recently upgraded its pages for that country to javascript and so now each page no longer has its own URL. I had been using simple VBA code to automatically get this data. Now I can only get the first page. When I hover over the link for the next page of data, the status bar says "javascript:goPage('002'). Is there a way to program the code to go to the next page?

I went to the source code of the page and I found the following snippet of code:

<form name='form_cont' method='post' action="st06.html">
<input type=hidden name="contgb" value="0">

<input type=hidden name="code" value="005930">
<input type=hidden name="gubun" value="4">
<input type=hidden name="page" value="2">
</form>

Is there a way using VBA to change the hidden value of the page?

Thanks,

Richard




Sub GetStockPrices()

URL = "URL;" & " & TickerSymbol

With ActiveSheet.QueryTables.Add(Connection:=URL, Destination:=Range("a1")) 'write web-page to sheet
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.BackgroundQuery = True
.AdjustColumnWidth = False
.WebFormatting = xlWebFormattingNone
.WebTables = "7,8,13,14"
.refresh BackgroundQuery:=False
End With
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top