Declare each one
When setting up a macro in VBA, if you want to declare multiple variables in one line of code, be sure to specify the type for each variable, even if the variables are the same type. Avoid code like the following:
Dim strFName, strLName, strMI As String
In such a case, only the last variable, strMI, is actually declared as a String type. The first two variables are designated by default as Variant data types.
To correctly declare the three variables, you would use the statement:
Dim strFName As String, strLName As String, strMI As String
See all Topics word
No comments:
Post a Comment