Jumat, 02 Januari 2015

[ExcelVBA] QueryTables

 

Hello,


Happy New Year to all!


I have a query I am doing to the nasdaq to get Income Statements. I started with Annual Statements and the query works wells.


thisurl = "http://www.nasdaq.com/symbol/" & Symbol & "/financials?query=income-statement"


I bring in the full page and then clean it up, no problem. But then I decided I would give the user the choice to get quarterly data instead.


YrorQtr = UCase(InputBox("Yearly or quarterly?", "Yr or Qr", "Yr Qr"))


Then I use a simple if statement to choose the URL

If YrorQtr = "YR" Then
    thisurl = "http://www.nasdaq.com/symbol/" & Symbol & "/financials?query=income-statement"
  ElseIf YrorQtr = "QR" Then  (THIS IS WHAT FAILS)
    thisurl = "http://www.nasdaq.com/symbol/" & Symbol & "/financials?query=income-statement&data=quarterly"
  Else
    Stop
  End If
  Set QT = ActiveSheet.QueryTables.Add(Connection:="URL;" & thisurl, _
    Destination:=Range("A1"))
  With QT
    .WebSelectionType = xlEntirePage
    .Refresh BackgroundQuery:=False
  End With


It always gives me annual statements. Any ideas how I can change this.


Thanks for your time and efforts.

David

__._,_.___

Posted by: who1012000@yahoo.com
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (1)
----------------------------------
Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go here: http://www.mousetrax.com/techtrax to enter the ezine, then search the ARCHIVES for EXCEL VBA.

----------------------------------
Visit our ExcelVBA group home page for more info and support files:
http://groups.yahoo.com/group/ExcelVBA

----------------------------------
More free tutorials and resources available at:
http://www.mousetrax.com

----------------------------------

.

__,_._,___

Tidak ada komentar:

Poskan Komentar