Syntax error
Visual Basic can't determine what action to take. This error has the following causes and solutions:
A keyword or argument is misspelled.
Keywords and the names of named arguments must exactly match those specified in their syntax specifications. Check online Help, and then correct the spelling.
Punctuation is incorrect. For example, when you omit optional arguments positionally, you must substitute a comma (,) as a placeholder for the omitted argument.
A procedure isn't defined.
Check the spelling of the procedure name.
You tried to specify both Optional and ParamArray in the same procedure declaration. A ParamArray argument can't be Optional. Choose one and delete the other.
You tried to define an event procedure with an Optional or ParamArray parameter. Remove the Optional or ParamArray keyword from the parameter specification.
You tried to use a named argument in a RaiseEvent statement. Events don't support named arguments.
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.