Type-declaration character required
The necessity of using type-declaration characters depends on the form of the identifier's declaration. This error has the following cause and solution:
A variable that was originally implicitly declared with a type-declaration characters was referenced without a type-declaration character. For example:
MyStr$ = "Implicit declaration" MyStr = "Trying to refer to MyStr$, but error results" _ & "from calling it MyStr."
Dim MyStr$ MyStr = "Because it was explicitly declared, the $ is optional."
Either make the declaration explicit, or add the type-declaration character to later references.
Note
If an explicit variable declaration contains a type-declaration character, inclusion of the character is optional in later references.
For additional information, select the item in question and press F1 (in Windows) or HELP (on the Macintosh).
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.