作者jami520 (我的生命因你而发光)
看板Visual_Basic
标题[VBA ] 撷取网页资料,没有资料时候不出现警告视窗
时间Sat Dec 25 22:08:10 2010
目前我有写一段VBA以POST方式去撷取网页资料
但当撷取网页资料,没有资料时候会跳出警告视窗,程式就中断了
不知道要用怎样方式克服呢? thx
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;
http://abc.asp",Destination:=Range("A1"))
.PostText = Qyt_ptxt 'POST的参数
.Name = "测试撷取"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = False
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlOverwriteCells
.SavePassword = False
.SaveData = False
.AdjustColumnWidth = False
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingNone
.WebTables = "2"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 182.235.68.160
1F:→ bulldog:On Error Next 12/26 01:18