VBA & Macro Problems

How to Fix Access VBA Runtime Error 53 File Not Found for Missing DLL

Muhammad TalhaMuhammad Talha Nov 2, 2026 871 views

Question details

The user encounters Runtime Error 53 in Access VBA when attempting to call a third-party DLL that works successfully in Excel VBA.

How to Fix Access VBA Runtime Error 53 for a Missing DLL
Product
Microsoft Access (Office 2019)
Device & OS
Windows (64-bit)
Scenario
Calling a third-party DLL function via a VBA Declare statement in Microsoft Access.
Observed behavior
Access VBA throws 'Runtime Error 53: File Not Found' despite the DLL folder being properly included in the Windows system PATH environment variable.
Before you start

Ensure you have administrator privileges to access the drive paths where your DLL files are stored, and confirm whether your Microsoft Office installation is exactly 32-bit or 64-bit.

Solution 1Recommended

Specify the Absolute Path in the VBA Declare Statement

Bypass system PATH resolution discrepancies between Excel and Access by hardcoding the exact location of the DLL file directly in your VBA declaration.

While Excel might successfully locate the DLL via the system PATH variable, Access VBA can sometimes fail to resolve the exact directory, resulting in Error 53. Explicitly declaring the absolute path resolves this discrepancy and forces Access to look in the correct folder.

1
Open the VBA Editor

Open your Access Database and press ALT + F11 to open the Microsoft Visual Basic for Applications (VBA) Editor.

2
Locate the API Declaration

In the Project Explorer pane on the left, locate and open the module containing your DLL API declaration.

3
Update the Lib Argument

Modify the 'Lib' argument in your 'Declare' statement to include the full file path to the DLL. For example, change it to: Declare PtrSafe Function XPRMinit Lib "C:\Path\To\Your\DLL\xprm_rt.dll" () As Long.

4
Save and Test

Save the VBA module and run your code again to confirm that Runtime Error 53 is resolved.

Specify the Absolute Path in the VBA Declare Statement
Include PtrSafe for 64-bit Office: Because you are using 64-bit Office 2019, ensure the PtrSafe keyword is included in your Declare statement, otherwise you will encounter a separate compilation error.
Free Microsoft Office alternative

Looking for a Lighter, Highly Compatible Office Suite?

While WPS Office does not feature a database tool like MS Access, if you are looking for an intuitive, crash-free, and highly compatible alternative for your Word, Excel, and PowerPoint needs, WPS Office is an excellent choice. It natively supports VBA macros in its Spreadsheet application, making automation easy.

Seamlessly compatible with Microsoft Excel (.xlsx, .xlsm) and Word formats.Advanced Spreadsheet tool with robust built-in VBA macro support for cross-platform automation.Lightweight installation footprint and highly resource-friendly operation.Free to download and use with a highly familiar, tabbed user interface.
microsoft office alternative - wps office

Frequently Asked Questions

What does Runtime Error 53 mean in VBA?

Runtime Error 53 indicates 'File Not Found'. In the context of VBA Declare statements, it means the host application (like Access) cannot locate the specified dynamic-link library (DLL) file in the designated path, the current directory, or the system directories.

Why does the DLL work in Excel VBA but not Access VBA?

Excel and Access can process Windows System PATH environment variables differently when executing API calls. Access may fail to find the DLL if it relies solely on the PATH variable, requiring an absolute file path in the VBA Lib declaration to function correctly.

What is the PtrSafe keyword in VBA?

The PtrSafe keyword is required in 64-bit versions of Office (such as Office 2019 64-bit) to assert that a Declare statement is safe to run in 64-bit environments. It instructs VBA that the API call handles 64-bit memory addresses correctly, usually alongside data types like LongPtr.