The syntax of your statement indicates a variable or function call. This error has the following cause and solution:
Check the spelling of the name. Make sure that any variable or function with that name is visible in the portion of the program from which you are referencing it. For example, if a function is defined as Private or a variable isn't defined as Public, it's only visible within its own module.
MySub
is a Sub procedure, the following code generates this error:
MySub = 237 ' Causes Expected Function or variable error
Although you can use assignment syntax with a Property Let procedure or with a Function that returns an object or a Variant containing an object, you can't use assignment syntax with a Sub, Property Get, or Property Set procedure.
For additional information, select the item in question and press F1 (in Windows) or HELP (on the Macintosh).