Fix Access VBA Error 48 with the Excel Object Library
Question details
Resolve Access VBA error 48 associated with an Excel object library reference and access open Excel workbooks across Office versions.

- Product
- Microsoft Access VBA and Microsoft Excel
- Device & OS
- Windows 7 in the reported example
- Scenario
- An Access database uses an Excel object library reference to count open workbooks, but the installed Office version differs from the referenced version.
- Observed behavior
- Error 48 occurs when the database references the Excel 16.0 Object Library on a computer running Office 2013, before the procedure executes.
Check which versions of Access and Excel are installed using File > Account > About in each application. Open the database in Access and press Alt+F11 to inspect its VBA references.
Repair the Excel object library reference in Access VBA
Use this approach if the database should continue using an explicit Excel object library reference.
In Access, press Alt+F11, then select Tools > References in the VBA editor.
Look for entries marked MISSING. Clear a broken Excel reference and, if available, select the Microsoft Excel Object Library that matches the installed Excel version.
Select OK, then choose Debug > Compile in the VBA editor. Address any remaining missing references or compile errors before running the procedure.

Use late binding to count open Excel workbooks
Use late binding to avoid tying this code to a specific Excel object library version.
Work with Excel files in WPS Office
WPS Office is a free, lightweight alternative for everyday spreadsheet work, with a familiar interface and support for common Excel formats to make migration easier. It does not repair Access VBA references or replace Microsoft Access.

Frequently Asked Questions
Where can I find a missing Excel reference in Access?
Press Alt+F11 in Access, then select Tools > References. Look for a checked entry marked MISSING and replace it with the installed Excel object library if your code needs an explicit reference.
What is the difference between early and late binding?
Early binding uses an explicit Excel object library reference and Excel-specific types. Late binding uses Object variables and resolves Excel members at runtime, avoiding a dependency on a specific Excel library reference.
Does GetObject start Excel if it is closed?
No. GetObject(, "Excel.Application") connects to a running Excel instance and returns an error if one is not available. Open Excel before running the workbook-counting example.
Why does Workbooks.Count need an Excel object in Access?
Workbooks belongs to Excel's application object. In Access, qualify it with the Excel variable, such as oExcel.Workbooks.Count, after connecting to Excel.
What if error 48 continues after I fix the reference?
Compile the project with Debug > Compile and check Tools > References again. Error 48 can also involve another DLL dependency or an Office installation issue, so the Excel reference may not be the only cause.




