我編寫了一個Web查詢宏,用于根據單元格A1中的值從Yahoo Finance導入財務報表。在過去的幾周中,它一直無縫運行,但是突然,它不再返回任何數據(但不會產生錯誤)。如果有人有任何見解,請多多關照。我在下面發布了代碼-謝謝!Sub ThreeFinancialStatements() On Error GoTo Explanation Rows("2:1000").Select Selection.ClearContents Columns("B:AAT").Select Range(Selection, Selection.End(xlToRight)).Select Selection.ClearContents Dim inTicker As String inTicker = Range("A1") ActiveSheet.Name = UCase(inTicker) GetFinStats inTicker Exit SubExplanation: MsgBox "Please make sure you type a valid stock ticker symbol into cell A1 and are not trying to create a duplicate sheet." & _ vbLf & " " & _ vbLf & "Also, for companies with different classes of shares (e.g. Berkshire Hathaway), use a hyphen to designate the ticker symbol instead of a period (e.g. BRK-A)." & _ vbLf & " " & _ vbLf & "Please also note that not every company has three years of financial statements, so data may appear incomplete or missing for some companies.", _ , "Error" Exit SubEnd SubSub GetFinStats(inTicker As String)'' GetBalSheet Macro'' With ActiveSheet.QueryTables.Add(Connection:= _ "URL;http://finance.yahoo.com/q/bs?s=" & inTicker & "+Balance+Sheet&annual", Destination:= _ Range("$D$1")) .Name = "bs?s=PEP+Balance+Sheet&annual" .FieldNames = True .RowNumbers = False .FillAdjacentFormulas = False .PreserveFormatting = True .RefreshOnFileOpen = False .BackgroundQuery = True .RefreshStyle = xlOverwriteCells .SavePassword = False .SaveData = True .AdjustColumnWidth = True .RefreshPeriod = 0 .WebSelectionType = xlSpecifiedTables .WebFormatting = xlWebFormattingNone .WebTables = "9" .WebPreFormattedTextToColumns = True .WebConsecutiveDelimitersAsOne = True .WebSingleBlockTextImport = False .WebDisableDateRecognition = False .WebDisableRedirections = False .Refresh BackgroundQuery:=False End WithEnd Sub
- 3 回答
- 0 關注
- 583 瀏覽
相關問題推薦
添加回答
舉報
0/150
提交
取消