ID: Q135879
The information in this article applies to:
In the versions of Microsoft Excel listed above, the Help topic for the Visual Basic Option Base statement contains the following information:
The Option Base statement has no effect on arrays within user-defined
types for which the lower bound is always 0.
This information is not entirely correct.
This statement is not true for an array within your user-defined type. For example, when you run the following code, the value 1 is returned, instead of the expected value 0 for the lower bound of the array within the user- defined type Mytype:
Option Base 1
Type Mytype
Machine(2) As String
End Type
Sub Test_Mytype()
Dim Test As Mytype
MsgBox LBound(Test.Machine)
End Sub
Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact the Microsoft fee-based consulting line at (800) 936-5200. For more information about the support options available from Microsoft, please see the following page on the World Wide Web:
http://www.microsoft.com/support/supportnet/refguide/
If you want the lower bound for an array within your user-defined type to
be zero, you can use any of the following methods.
Use the "To" clause to explicitly define the upper and lower bounds of your array. This method overrides any Option Base settings in your module. The following is an example of using this method:
Type Mytype
Machine(0 To 2) As String
End Type
Use the Option Base statement with the value 0 by adding the following statement at the beginning of your module:
Option Base 0
Do not use the Option Base statement at all; the default base is 0.
Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. This problem was corrected in Microsoft Excel 97 for Windows and Microsoft Excel 98 Macintosh Edition.
For more information about the "Option Base Statement," choose the Search button in the Visual Basic Reference (version 5.0) and type:
Option Base
Additional query words: 5.00 5.00a 5.00c 7.00 XL5 XL7
Keywords : kbcode kbprg PgmOthr
Version : WINDOWS:5.0,5.0c,7.0; MACINTOSH:5.0,5.0a
Platform : MACINTOSH WINDOWS
Issue type : kbbug
Solution Type : kbfix
Last Reviewed: May 17, 1999