Expected Sub, Function, or Property

The syntax of your statement indicates a Sub, Function, or Property procedure invocation. This error has the following cause and solution:

  • The specified name isn't that of a Sub, Function, or Property procedure in scope in this part of your program.

    Check the spelling of the name. Note that if the procedure is defined as Private, it can only be called from within its module.

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.