名叫number的string
Dim number As String
number = "請輸入代號,空白預設為2330"
number = InputBox(number)
If number = "" Then
number = "2330"
End If
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://dj.mybank.com.tw/z/zc/zcp/zcpa/zcpa_" + number + ".asp.htm", Destination:=Range("$A$1"))
.Name = "test"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlOverwriteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingNone
.WebTables = "3"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
[陽だまり 在 2012-6-1 07:48 PM 作了最後編輯]