作者WhiskyLin (R&D = Retry and Delay)
看板Visual_Basic
标题[VBA ] Excel 的新增 Web 查询
时间Tue Nov 28 23:15:21 2006
问一个很基本的问题。
我目前有在使用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