The VBA runtime error 432—"File name or class name not found during automation"—occurs when your script references a missing object, module, or reference in Excel, Access, or another Microsoft Office app. This happens when you try to use a class, function, or reference that doesn’t exist in the active environment, often due to incorrect setup, missing DLLs, or outdated libraries. The quickest fix is to restore proper VBA references, but deeper issues may require reconfiguring your workflow.

What You'll Need

  • Access to the Excel workbook or application where the error occurs (Excel 2013+ recommended for modern VBA support).
  • Administrator rights (to modify system-level references).
  • A secondary Excel file (for testing reference changes without corrupting the original).
  • Microsoft Visual Basic Editor (VBE) open (press Alt+F11 in Excel).

Step-by-Step

  1. Verify the Missing Reference
    1. Open your VBA project in the VBE (Alt+F11).
    2. In the Project Explorer, expand Microsoft Excel Objects or YourWorkbookName.
    3. Right-click Microsoft Excel XX.X Object Library (e.g., Microsoft Excel 16.0 Object Library) and select Add Reference. If this library is missing, the error stems from a broken reference setup.
    4. Check the References window (Tools > References). If any Microsoft-related entries (e.g., Microsoft Scripting Runtime, Microsoft Visual Basic for Applications Extensions) are missing or crossed out, add or reinstall them. For Windows systems: Ensure they’re installed via the Microsoft Office Tools pack or update Office via Control Panel > Programs > Programs and Features.
  2. Reinstall Missing DLLs or Libraries
    1. If the error persists after adding references, the system DLL might be corrupted. Use DLL.exe /i (Windows System File Checker) to scan and repair system files: System32>dllchk.exe /scan (run as admin).
    2. For Office-specific issues, reinstall the Office suite or re-add the Microsoft.Office.XXX assemblies via Command Prompt (as admin): regsvr32 /u /nmsa C:\Windows\SysWOW64\OLEAUT32.dll Replace OLEAUT32.dll with the missing DLL from the Office installation folder (e.g., C:\Program Files\Microsoft Office\Root\Office16).
  3. Fix the VBA Project Itself
    1. Open the problematic workbook and save it as .xlsm (macros-enabled) if it’s not already. Ensure no VBA errors exist in the project by running Tools > Error Checking.
    2. If the error occurs in a third-party add-in, disable the add-in in File > Options > Add-ins (uncheck the name) and test if the error vanishes.
    3. If the issue is in a custom class module, verify the class name matches exactly in both the module’s Class Module tab and the code. Capitalization matters:
      Public Sub Test()
          Dim obj As New MyClass ' Must match the class name exactly!
          obj.DoSomething
      End Sub
  4. Restart and Test Clean Environments
    1. Close all Excel instances and restart your PC. Sometimes cached references cause conflicts.
    2. Create a fresh blank workbook and paste the macro code into a new project. If the error disappears, the issue is environment-specific and likely tied to the original file’s corruption.
  5. Reinstall VBA Components
    1. If all else fails, reinstall the VBA editor and Office components:
      1. Uninstall Office from Control Panel > Programs.
      2. Download the latest Office installer from Microsoft’s website (verify for your Office version).
      3. Restart your PC after installation.

If That Did Not Work

If VBA error 432 persists after the above steps, consider:
  1. Checking your system’s date/time settings (Windows may fail to load certain DLLs if incorrect).
  2. Running msiexec /f [OfficeInstallerPath] to repair Office silently.
  3. Falling back to VBA 6.0 (legacy) if the error involves older Office versions, though this is rarely necessary today.

Common Mistakes

  • Forgetting to Update References: Skipping the Tools > References step after adding DLLs or Office reinstallation leaves the project broken.
  • Case-Sensitive Class Names**: VBA is case-sensitive. A typo in the class name (e.g., MyClass vs myclass) will trigger error 432 during automation.
  • Corrupt Office Installation**: Reinstalling Office without removing old versions may leave DLLs in conflict.
  • Running as Non-Admin**: Some DLL repairs require elevated permissions. Always run repair tools as Administrator.

Tips

  • Use a Test Workbook**: Always replicate the error in a clean file before troubleshooting the original project.
  • Check the Error Window**: Click the Debug button in VBE and examine the line number where the error occurs. This pinpoints the exact reference issue.
  • Enable Macro Security**: Go to File > Options > Trust Center > Macro Settings and verify macros are enabled for the relevant workbook.
  • Use Online References**: For third-party VBA libraries, download them directly from trusted sources (e.g., CodeProject) and add the path manually via Tools > References > Browse....
  • Backup First**: Always save a backup before reinstalling Office or running system tools.

Troubleshooting

  1. Error Occurs When Opening Excel
    1. Restart your PC and try again. This clears cached references.
    2. Open a secondary Excel file to test if the error is workbook-specific or system-wide. If it’s workbook-specific, the issue is in that file’s VBA code or missing references.
  2. Error After Implementing a New Add-In
    1. Disable add-ins temporarily and re-enable them one by one to isolate the culprit.
    2. If the add-in is from a third party, check its documentation for compatibility requirements.
  3. Error Persists After Reinstalling Office
    1. Use the repair option in the Office installer (not just uninstall/reinstall).
    2. Run sfc /scannow in Command Prompt as Administrator to check system integrity.

Frequently Asked Questions

Why does VBA Error 432 keep happening even after reinstalling Office?

Even after reinstalling Office, residual DLLs or cached references might remain. Uninstall Office completely (via Control Panel > Programs > Add/Remove Programs), delete leftover files in C:\Program Files\Microsoft Office, then reinstall. Additionally, check if your system’s date/time is synchronized correctly—incorrect timestamps can prevent DLL loading.

How do I fix VBA Error 432 in Excel 2016?

For Excel 2016, ensure the Microsoft Excel XX.X Object Library (e.g., Microsoft Excel 16.0 Object Library) is added via Tools > References. If it’s missing, the Office installation may be incomplete. Download the latest Office update from Microsoft’s support site and install it.

Can I use third-party VBA libraries without error 432?

Yes, but you must manually add the library’s path in the References window. Navigate to the DLL or COM library’s folder and select Browse.... If the library is from an untrusted source, test it in a secondary workbook first.

What if VBA error 432 occurs in Access instead of Excel?

For Microsoft Access, the process is similar. Open the VBA editor (Alt+F11) and ensure the Microsoft Access XX.X Object Library is added. Access may also require the Microsoft Scripting Runtime reference. If the error involves a custom class, verify the class name matches exactly in both the module and the code.

Why does my VBA script work in one workbook but not another?

This usually indicates a difference in references or environment settings. Open both workbooks in the VBE and compare their References lists. Re-add any missing entries in the problematic workbook. Alternatively, create a new VBA project and copy the code over to test for compatibility issues.

Is there a way to disable VBA error 432 without fixing the root cause?

No, error 432 is a genuine runtime error. You cannot bypass it without fixing the underlying cause (missing DLL, incorrect reference, or syntax error). Using workarounds like error handling (On Error Resume Next) will suppress the error but may break functionality.