Table of contents
TOC
Collapse the table of content
Expand the table of content

Expected Function or variable

office 365 dev account|Last Updated: 6/12/2017
|
1 Contributor

The syntax of your statement indicates a variable or function call. This error has the following cause and solution:

  • The name isn't that of a known variable or Function procedure.

    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 ownmodule.

  • You are trying to inappropriately assign a value to a procedure name.

    For example if 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).

© 2018 Microsoft