Runtime error 35 in VBA means the macro called a procedure that the VBA project cannot find. The usual cause is a typo in the procedure name, a missing reference, or code that lives in a different module or workbook than the one calling it. Fix it by confirming the exact procedure name, checking that the module containing it is present and compiled, and adding any missing library reference under Tools > References.

What You'll Need

  • Access to the VBA editor (Alt+F11 in Excel, Word, Access, PowerPoint, or Outlook).
  • The workbook or document that contains the failing macro.
  • Any add-in or library the macro depends on, installed and registered on the same machine.
  • Permission to edit the VBA project (macro security may block editing in some environments).

Step-by-Step

  1. Open the VBA editor with Alt+F11, then click Debug > Compile VBAProject. If the compiler stops on a line, that line is where the missing name is referenced. Note the exact procedure name it flags.
  2. Press Ctrl+F to open the Find dialog. Search for the flagged name with Current Project selected. If nothing is found, the procedure does not exist in this project, which is the root of error 35.
  3. Compare the spelling in the calling line with the spelling in the procedure's Sub or Function statement. VBA is case-insensitive, but a missing letter, an extra space, or a hyphen instead of an underscore will still break the call.
  4. Check that the procedure is declared Public (or has no explicit modifier) if it is called from another module. A Private procedure is invisible outside its own module and will trigger the same error.
  5. If the procedure lives in another workbook or add-in, open Tools > References and confirm that project is listed and ticked. If it is not listed, use Browse to point to the file, then tick it.
  6. For calls into another workbook, qualify the call with the project name, for example MyAddin.Module1.MyMacro, rather than calling MyMacro on its own.
  7. If the missing name is a Windows API function, confirm the Declare statement is present at the top of a standard module and that the library name (for example user32) is spelled correctly.
  8. After any edit, run Debug > Compile VBAProject again, then run the macro. A clean compile with no highlighted line means the reference now resolves.
  9. If the project still fails, close the editor, save and reopen the file, and re-run. This clears stale compiled state that can survive an edit.

Common Mistakes

  • Renaming a procedure in one place but not updating every call site. Use Find to check all occurrences before renaming.
  • Assuming a procedure is available because it exists in another open workbook. Each VBA project is separate unless you add a reference.
  • Putting a Function that is meant to be called from a worksheet in a Private module, or naming it the same as a cell reference, which causes ambiguous calls.
  • Forgetting that 64-bit Office requires PtrSafe on API declarations. A missing or mismatched declaration can surface as a name-not-found error rather than a type error.
  • Editing code in a protected project. If the project is locked, the editor will not let you fix the reference; you need the password or a copy of the file.

Tips

  • Add Option Explicit at the top of every module. It forces variable declarations and catches many name typos at compile time instead of at run time.
  • Use IntelliSense: type the project name and a dot, and the editor lists available modules and procedures. If the name you expect is missing, the reference is the problem.
  • Keep helper procedures in a dedicated standard module with clear, unique names so they are easy to find and reference.
  • When sharing a workbook, include any referenced add-ins or note them in the file, because a missing add-in on another machine reproduces error 35.
  • Compile before every test run. It is faster than stepping through code to find a missing name.

Troubleshooting

If Compile VBAProject does not flag anything but the error still appears at run time, the problem is likely a late-bound call or a reference that resolves only on another machine. Check Tools > References for entries marked MISSING and untick or re-point them.

If the error appears only when a specific button or shortcut is pressed, inspect the assigned macro name in the button's properties or the Quick Access Toolbar customization. A renamed macro leaves the old name assigned, which produces error 35 on click.

If the project is password-protected, you cannot edit it; ask the author for an unlocked copy rather than attempting to bypass protection. If the file came from an untrusted source, macro security may have disabled the project entirely, in which case enable macros only after confirming the source is safe.

If the error persists after all of the above, export the modules (File > Export File), create a fresh workbook, and import them one at a time to isolate the module causing the conflict.

Frequently Asked Questions

What does runtime error 35 actually mean?

It means VBA reached a line that calls a Sub or Function by name and could not find a matching procedure in the current project or its referenced libraries.

Why does the macro work on one computer but not another?

The other computer is probably missing an add-in, a referenced library, or a different version of the file. Check Tools > References on both machines and compare.

Can a typo in a variable name cause error 35?

Not directly. A misspelled variable usually causes a different error. Error 35 is specifically about a procedure name, so focus on Sub and Function names and references.

Does renaming a module break existing calls?

Yes, if the call is qualified with the module name. Unqualified calls within the same project usually still work, but qualified calls such as Module1.MyMacro will fail until updated.

Is error 35 related to macro security settings?

Indirectly. If macros are disabled, the project may not load its referenced components, which can surface as a missing procedure. Enable macros only for files you trust.

How do I fix error 35 in a protected workbook?

You cannot edit a protected VBA project without the password. Request an unlocked copy from the author or use a version of the file that is not protected.