我要聲明多個變量,變量申報數量取決於輸入所以它是這樣的:如何聲明可變數量的索引字符串?
Sub Main()
Dim TotalNumber As Long
TotalNumber = InputBox("Please enter total number of words")
Dim i As Long
Dim MsgDisp As String
Dim Words(1 To TotalNumber) As String
For i = 1 To TotalNumber
String(i) = InputBox("Please type the words for number " & i)
MsgDisp = MsgDisp & String(i) & Chr(10)
Next i
MsgBox(MsgDisp)
End Sub
然而,我得到了錯誤的「要求常量表達式」在6號線 任何幫助讚賞...
謝謝!這就是它。我不知道尺寸必須單獨定義。 –