[VBA ] 擷取網頁資料,沒有資料時候不出現警告視窗

看板Visual_Basic作者 (我的生命因你而發光)時間15年前 (2010/12/25 22:08), 編輯推噓0(001)
留言1則, 1人參與, 最新討論串1/1
目前我有寫一段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

12/26 01:18, , 1F
On Error Next
12/26 01:18, 1F
文章代碼(AID): #1D5VhDtT (Visual_Basic)
文章代碼(AID): #1D5VhDtT (Visual_Basic)