# Why won't this code work? (VBScript)

**URL:** <https://boards.straightdope.com/t/why-wont-this-code-work-vbscript/506411>\
**Category:** Factual Questions\
**Created:** [August 14, 2009, 3:45pm UTC](https://boards.straightdope.com/t/why-wont-this-code-work-vbscript/506411 "2009-08-14T15:45:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tdn](https://avatars.discourse-cdn.com/v4/letter/t/94ad74/32.png) [@tdn](https://boards.straightdope.com/u/tdn)\
**Post date:** [August 14, 2009, 3:45pm UTC](https://boards.straightdope.com/t/why-wont-this-code-work-vbscript/506411/1 "2009-08-14T15:45:39Z")

</div>

I have this code in an ASP page:

Dim UpperBound  
UpperBound = 42  
Dim MortReason(UpperBound, 1)

And I get this result:

Expected integer constant

/GenSurgHP/ComplicationsACSMortality.asp, line 655

Dim MortReason(UpperBound, 1)  
---------------^

(The little arrow points to the U in UpperBound.)

Can I really not dim an array with a variable?

---

<div class="post-metadata">

**Author:** ![tdn](https://avatars.discourse-cdn.com/v4/letter/t/94ad74/32.png) [@tdn](https://boards.straightdope.com/u/tdn)\
**Post date:** [August 14, 2009, 4:01pm UTC](https://boards.straightdope.com/t/why-wont-this-code-work-vbscript/506411/2 "2009-08-14T16:01:36Z")

</div>

Nevermind. I can’t Dim it, but I can ReDim it.
