XL5: Data Type Example Does Not Work with Dynamic ArrayLast reviewed: September 12, 1996Article ID: Q119131 |
The information in this article applies to:
SYMPTOMSWhen you run the example code on page 118 of the "Visual Basic User's Guide," included with Microsoft Excel version 5.0, you receive the following error message:
Run-time error '9': Subscript out of rangeThe following code assumes that you are referring to the fixed-size array example:
Dim MySystem As SystemInfo MySystem.DiskDrives(1)="1.44 MB"However, if you use this code with a dynamic array, you receive the error message above.
WORKAROUNDTo work around this problem, add the Redim statement to the code in the example, as shown in the example below:
Dim MySystem As SystemInfo Redim MySystem.DiskDrives(5) As String MySystem.DiskDrives(1)="1.44 MB" REFERENCES"Visual Basic User's Guide," version 5.0, page 118
|
KBCategory: kbprg
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |