- 帖子
- 2035
- 主題
- 24
- 精華
- 0
- 積分
- 2031
- 點名
- 0
- 作業系統
- Win7
- 軟體版本
- Office2010
- 閱讀權限
- 100
- 性別
- 男
- 註冊時間
- 2012-3-22
- 最後登錄
- 2024-2-1
|
54#
發表於 2016-9-8 10:50
| 只看該作者
回復 51# zyzzyva
我想要的出來結果是:(如 下)- Sub Ex()
- Dim strURL$ '宣告strURL為變數
- strURL = "http://www.taifex.com.tw/chinese/3/7_12_3.asp" '定義strURL變數內容
- [a1].CurrentRegion.ClearContents ' 清除文字沒清除格式(美化好的表格)
-
- With ActiveSheet.QueryTables.Add(Connection:= _
- "URL;" & strURL, Destination:=Range( _
- "$A$1"))
- .Name = "期貨契約"
- .FieldNames = True
- .RowNumbers = False
- .FillAdjacentFormulas = False
- .PreserveFormatting = False
- .RefreshOnFileOpen = False
- .BackgroundQuery = False
- .RefreshStyle = xlOverwriteCells
- .AdjustColumnWidth = False
- .WebSelectionType = xlSpecifiedTables
- .WebFormatting = xlWebFormattingNone
- .WebTables = "3" ' 第 3 個 Table
- .WebPreFormattedTextToColumns = True
- .WebConsecutiveDelimitersAsOne = True
- .WebSingleBlockTextImport = False
- .WebDisableDateRecognition = True
- .WebDisableRedirections = False
- .Refresh BackgroundQuery:=False
- .Delete
- End With
- End Sub
複製代碼
|
|