0

I'm having a few problems with the following:

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"

I get the error "Expected end of statement"

Similarly:

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"

says "Expecting ')' "

I don't often use VBA, but from the quick googling I did at least one of these should work?

1
  • Which line is the error on? Just checking. Commented Sep 9, 2014 at 14:05

1 Answer 1

3

Thats perfectly valid VBA however you will get those exact errors in VBScript which is what I presume your using.

As VBScript is typeless change the first line to just:

Dim design(5)
Sign up to request clarification or add additional context in comments.

2 Comments

Ah brilliant, as I said, I don't use it much so I had no idea :)
Actually, you should use Dim design(5) since you define the upper-bound in VB/VBA/VBScript. Using 5 will create a six-element array (0-5)which is what you apparently need.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.