我有一个录制的宏来从 Web 服务中提取选择字段,URL 类似于http://xxxx.com/reportviewer.aspx?ids= 123456789012 我想提示用户输入该数字作为变量并有如果该数字在宏中使用,则传递到 2 个位置的数字。
我知道我必须创建另一个宏来让用户输入一个值,之后我不确定如何将它传递到正确的位置?
到目前为止,这是我的代码
Sub Macro2()
'
' Macro2 Macro
'
' Keyboard Shortcut: Ctrl+r
'
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://xxxx.com/reportviewer.aspx?ids=123456789012", _
Destination:=Range("$A$1"))
.Name = "reportviewer.aspx?ids=123456789012"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingNone
.WebTables = "30,33,37,38,46"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
End Sub
Range("A2").Select