Vba 在消息框中使用数组值时遇到问题
我不太喜欢VBA,但尝试了一些代码,但遇到了一些错误,我不知道哪里出错了。我希望有人帮我解决问题 我在代码中使用数组,并将拆分字符串存储到数组中,如果我在excel范围中检索数组值,它将正常工作,但我想在msgBox中使用数组值,我收到错误“键入未匹配项编号13” 这是我的密码Vba 在消息框中使用数组值时遇到问题,vba,Vba,我不太喜欢VBA,但尝试了一些代码,但遇到了一些错误,我不知道哪里出错了。我希望有人帮我解决问题 我在代码中使用数组,并将拆分字符串存储到数组中,如果我在excel范围中检索数组值,它将正常工作,但我想在msgBox中使用数组值,我收到错误“键入未匹配项编号13” 这是我的密码 Public Sub UrlLinks() Dim MSX As Object Dim HTML As HTMLDocument Dim URLary, R
Public Sub UrlLinks()
Dim MSX As Object
Dim HTML As HTMLDocument
Dim URLary, RsltArr(6, 10) As Variant
Dim Key(9)
Dim UrlResponse, sKey, Str As String
Dim N As Long
'Call Clear_Browser
'On Error Resume Next
Set MSX = CreateObject("MSXML2.XMLHTTP")
Set HTML = New HTMLDocument
URLary = Application.Transpose(Range("A1:A10"))
For N = 1 To 1
With MSX
.Open "GET", URLary(N), False
.setRequestHeader "If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT"
.send
UrlResponse = StrConv(.responseBody, vbUnicode)
End With
sKey = Split(Split(UrlResponse, "smoothing:grayscale}.icon-")(1), Chr(34) & "}.mobilesv")(0)
sKey = Replace$(sKey, ":before{content:""\9d", Chr$(32))
sKey = Replace$(sKey, Chr(34) & "}.icon", "")
For i = 0 To 9
Key(i) = Split(Split(sKey, "-")(i), Chr(32))
ActiveCell.Offset(i, 0) = Key(i)
MsgBox Key(i) 'faccing error here
Next
@BigBen如果我花更多的时间来研究它会有所帮助:)
Key(I)
包含一个数组。您不能调试。打印或MsgBox
数组,但您可以使用其中一个元素来执行该操作。@BigBen,但我不知道如何使用它以及如何使用元素。.使用Join()
将数组元素组合成字符串。