Invalid type-declaration character

Type-declaration characters are valid, but don't exist for all data types; they aren't permitted in some situations. This error has the following causes and solutions:

  • A type-declaration character is appended to a variable declared in a Private, Public, or Static statement with an As clause.

    Remove the type-declaration character.

  • A type-declaration character is appended to an inconsistent literal. For example, since the ampersand (&) is the type-declaration character for a Long integer, appending it to a literal of a different type causes this error:

    10.253& 
    
    

    Remove the type-declaration character or replace it with the correct one.

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.