Invalid use of Me keyword

The Me keyword can appear in class modules. This error has the following causes and solutions:

  • The Me keyword appeared in a standard module.

    The Me keyword can't appear in a standard module because a standard module doesn't represent an object. If you copied the code in question from a class module, you have to replace the Me keyword with the specific object or form name to preserve the original reference.

  • The Me keyword appeared on the left side of a Set assignment, for example:
    Set Me = MyObject    ' Causes "Invalid use of Me keyword" message.
    

    Remove the Set assignment.

      Note
    The Me keyword can appear on the left side of a Let assignment, in which case the default property of the object represented by Me is set. For example:

Let Me = MyObject    ' Valid assignment with explicit Let.
Me = MyObject    ' Valid assignment with implicit Let.

For additional information, select the item in question and press F1 (in Windows) or HELP (on the Macintosh).

ofm