[VBA ] Excel 的新增 Web 查詢
看板Visual_Basic作者WhiskyLin (R&D = Retry and Delay)時間19年前 (2006/11/28 23:09)推噓0(0推 0噓 0→)留言0則, 0人參與討論串1/1
問一個很基本的問題。
我目前有在使用Excel:它裏面有一個「取得外部資料」
-> 「新增 Web 查詢」
滿好用的。可以直接把網頁資料取下來。
我想利用它做拍賣資料的管理。
這邊碰到一個問題:就是你要查詢的網址必須要在對話窗裏輸入。
我想把它改成可以查據某個儲存格的資料自動變更。
所以就去錄製了巨集。得到下列程式碼:
那接下來要怎麼改,才能讓那個 網址 變成某個儲存格的資料呢?
Sub Macro1()
'
' Macro1 巨集表
' MicroSoft Office 2000 在 2006/11/28 錄製的巨集
'
'
With ActiveSheet.QueryTables.Add( _
Connection:="URL;http://www.google.com.tw/" _
, Destination:=Range("A1"))
.Name = "外部資料_1"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlAllTables
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.Refresh BackgroundQuery:=False
End With
End Sub
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 218.169.66.235
Visual_Basic 近期熱門文章
PTT數位生活區 即時熱門文章
1
10