- 帖子
- 5923
- 主題
- 13
- 精華
- 1
- 積分
- 5986
- 點名
- 0
- 作業系統
- win10
- 軟體版本
- Office 2010
- 閱讀權限
- 150
- 性別
- 男
- 來自
- 台灣基隆
- 註冊時間
- 2010-5-1
- 最後登錄
- 2022-1-23
        
|
2#
發表於 2011-5-1 20:43
| 只看該作者
回復 1# chwqk
試試看- Sub Macro1()
- On Error Resume Next
- For I = 1 To 12
- If I < 10 Then
- M = "0" & I
- Else: M = I
- End If
- RD = "99" & M
- MsgBox RD
- Sheets("減資查詢").Select
- Range("A1").Select
- With Selection.QueryTable
- .Connection = _
- "URL;http://www.twse.com.tw/docs1/data01/market/public_html/b" & RD & ".txt"
- .WebSelectionType = xlEntirePage
- .WebFormatting = xlWebFormattingNone
- .WebPreFormattedTextToColumns = True
- .WebConsecutiveDelimitersAsOne = True
- .WebSingleBlockTextImport = False
- .WebDisableDateRecognition = False
- .WebDisableRedirections = False
- .Refresh BackgroundQuery:=False
- End With
- If Err > 0 Then
- MsgBox "查不到 " & RD
- Err.Clear
- End If
- Next I
- End Sub
複製代碼 |
|