How to Fix Access VBA Runtime Error 53 File Not Found for Missing DLL
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.

- 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.
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.
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.
Open your Access Database and press ALT + F11 to open the Microsoft Visual Basic for Applications (VBA) Editor.
In the Project Explorer pane on the left, locate and open the module containing your DLL API declaration.
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.
Save the VBA module and run your code again to confirm that Runtime Error 53 is resolved.

Verify DLL Architecture and Office Bitness
Ensure the third-party DLL matches the 64-bit architecture of your Office 2019 installation, as mismatching bitness can also trigger file load errors.
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.

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.




