创建一个字符串数组

时间:2014-09-09 13:50:29

标签: arrays string vbscript

我遇到以下问题:

Dim design(6) As String

design(0) = "DES1"
design(1) = "DES1_slot"
design(2) = "DES2"
design(3) = "DES2_slot"
design(4) = "DES3"
design(5) = "DES3_slot"

我收到错误"预期声明结束"

类似地:

Dim design(0 To 5) As String

design(0) = "DES1"
design(1) = "DES1_slot"
design(2) = "DES2"
design(3) = "DES2_slot"
design(4) = "DES3"
design(5) = "DES3_slot"

说"期待')' "

我不经常使用VBA,但是通过快速谷歌搜索我至少有一个应该工作?

1 个答案:

答案 0 :(得分:3)

这完全有效 VBA 然而你会在 VBScript 中得到那些我认为你使用的确切错误。

由于VBScript是无类型的,所以将第一行改为:

Dim design(5)