varData = [{"Interbank Placement", "LIBOR/IB/COF"; "cat", "goku"; 4, "cow"; 6, "soccer"; "test", 8; "drinks", "goal"}]
我有这样的代码。它太长了,我想把它分成几行。我尝试了下面的代码,但它仍然说缺少括号。我怎样才能做到这一点?
varData = [{"Interbank Placement", "LIBOR/IB/COF"; _
"cat", "goku"; 4, "cow"; 6, "soccer"; "test", 8; "drinks", "goal"}]
答案 0 :(得分:1)
您可以在带有数组数据的字符串上使用Evaluate
来执行此操作 - 但前提是字符串已正确引用。这有点痛苦,但可能 - 见下文:
Option Explicit
Sub Test()
Dim strData As String
Dim varData As Variant
strData = "{""Interbank Placement"", ""LIBOR/IB/COF"";" & _
"""cat"", ""goku"";" & _
"4, ""cow"";" & _
"6, ""soccer"";" & _
"""test"", 8;" & _
"""drinks"", ""goal""}"
varData = Evaluate(strData)
MsgBox "varData is array of: " & UBound(varData, 1) & "x" & UBound(varData, 2)
End Sub