VBS暂停用户输入

时间:2018-02-26 19:15:17

标签: excel vba vbscript sap

我有一个vbs sap脚本,它与第一列中的所有无线电盒进行交易。 收音机的位置根据当天的时间而变化,因此我无法对代码中的行号进行硬编码。 是否可以暂停VBS脚本并让用户手动选择单选框,然后再继续使用代码?

1 个答案:

答案 0 :(得分:0)

您可以尝试放置Application InputBox函数调用

....your code

Dim myRange As Range 
Dim myRow As Long

Set myRange = Application.InputBox(prompt := "select a range in wanted row", type := 8) ‘this pause the execution and retrieve a range reference from the user
If not myRange Is Nothing Then ‘ if the user hasn’t canceled the input box dialogue 
    myRow = myRange.Rows(1).Row ‘get the row index of the first row of user selected range (should she have selected a multi rows range)

   ‘ use myRow for your business

End If