如何在VBScript中声明数组?
我在Excel中使用了此功能,它可以正常工作。
dim varScreen (0 to 2) as string
varScreen(0) = "sample 1"
varScreen(1) = "sample 2"
varScreen(2) = "sample 3"
我正在尝试将此数组转换为vbscript,但我一直遇到此错误:
Line: 14
Error: Expected ')'
我尝试了各种选项,将删除为字符串
,dim varscreen作为数组
,但我仍然会收到错误。
什么是正确的语法?
I used this in Excel and it works fine.
dim varScreen (0 to 2) as string
varScreen(0) = "sample 1"
varScreen(1) = "sample 2"
varScreen(2) = "sample 3"
I am trying to translate this array to VBScript but I keep getting this error:
Line: 14
Error: Expected ')'
I have tried various options, removed as string
, dim varScreen as array
but I still get the error.
What is the proper syntax?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您还可以使用
array,也可以动态创建数组
功能。有时,这比单独分配数组元素更方便。You can also create arrays dynamically using the
Array
function. Sometimes this is more convenient than assigning array elements separately.VBScript的(变量和)数组无法键入,因此没有“任何”。 VBScript的数组基于零,因此没有“(x至y)”,但仅“(z)”,其中z是数组的最后一个索引(而不是大小)。在代码中:
VBScript's (variables and) arrays can't be typed, so no "as Whatever". VBscript's arrays are zero-based, so no "(x To y)" but only "(z)" where z is the last index (not the size) of the array. In code: