Bewerken

Delen via


Invalid attribute in sub, function, or property

Some attributes are invalid within procedures. This error has the following cause and solution:

  • A Public or Private attribute appears within the body of a procedure definition. Remove the attribute from the procedure. To give the variable wider scope, move the declaration to module level. Variables declared within procedures are always Private.

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.