返回列表 上一主題 發帖

[發問] 請問網址可以用變數代替嗎?

回復 4# cji3cj6xu6
  1. Option Explicit
  2. Sub EX()
  3.     Dim WebAddress As String
  4.     WebAddress = "http://tw.stock.yahoo.com/q/q?s=1101"
  5.     Range("a2").Select
  6.      With ActiveSheet.QueryTables.Add(Connection:= _
  7.         "URL;" & WebAddress, Destination:=Selection) '新增查詢
  8.         .FieldNames = True
  9.         .RowNumbers = False
  10.         .FillAdjacentFormulas = False
  11.         .PreserveFormatting = True
  12.         .RefreshOnFileOpen = False
  13.         .BackgroundQuery = True
  14.         .RefreshStyle = xlInsertDeleteCells
  15.         .SavePassword = False
  16.         .SaveData = True
  17.         .AdjustColumnWidth = True
  18.         .RefreshPeriod = 0
  19.         .WebSelectionType = xlSpecifiedTables
  20.         .WebFormatting = xlWebFormattingNone
  21.         .WebTables = "6"
  22.         .WebPreFormattedTextToColumns = True
  23.         .WebConsecutiveDelimitersAsOne = True
  24.         .WebSingleBlockTextImport = False
  25.         .WebDisableDateRecognition = False
  26.         .WebDisableRedirections = False
  27.         .Refresh BackgroundQuery:=False
  28.         .Name = .ResultRange.Cells(3, 1)
  29.     End With
  30. End Sub
複製代碼
感恩的心......(在麻辣家族討論區.用心學習會有進步的)
但資源無限,後援有限,  一天1元的贊助,人人有能力.

TOP

        靜思自在 : 【生命在呼吸間】佛陀說:「生命在呼吸間。」人無法管住自己的生命,更無法擋住死期,讓自己永住人間。既然生命去來這麼無常,我們更應該好好地愛惜它、利用它、充實它,讓這無常、寶貴的生命,散發它真善美的光輝,映照出生命真正的價值。
返回列表 上一主題