Event handler is invalid

The parameter list of an event-handling procedure must precisely match the declaration of the event. This error has the following cause and solution:

  • Your event-handling procedure has the wrong number of parameters. Eliminate extra parameters or add the missing ones.

  • One or more of your event-handling procedure parameters has the wrong data type.

    Make the parameter types match those of the event declaration.

  • Your event-handling procedure is a Function rather than a Sub. Make your procedure a Sub. An event handler can't return a value.

  • Another type library uses the event name for a type of its own.

    Qualify the name with the name of the proper type library to avoid the ambiguity.

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.