Others

Fix Access VBA File Dialog Not Opening After Office Upgrade

Elise WilliamsElise Williams Nov 2, 2026 869 views

Question details

The VBA file-selection dialog fails to open during runtime after upgrading Microsoft Office.

How to Fix Access VBA File Dialog Not Opening After Upgrade
Product
Microsoft Access
Device & OS
Windows
Scenario
Running an Access database macro or VBA script that relies on Windows API calls like PathStripPath and GetOpenFileName to browse for files.
Observed behavior
Adding PtrSafe resolves the compile errors, but the file dialog still does not appear on screen when the code is executed.
Before you start

Verify whether your newly upgraded Microsoft Office installation is 32-bit or 64-bit, as migrating from 32-bit to 64-bit Office requires specific data type adjustments in your VBA code.

Solution 1Recommended

Update Windows API Declarations for 64-bit Compatibility

Use this solution if you recently upgraded to 64-bit Microsoft 365, as memory pointers in VBA must be updated from 32-bit to 64-bit variable types to function properly.

Simply adding 'PtrSafe' to your Declare statements allows the code to compile, but it does not fix runtime behavior in a 64-bit environment. Variables that store pointers or handles must be explicitly converted to LongPtr.

1
Open the VBA Editor

Launch Microsoft Access and press Alt + F11 on your keyboard to open the Visual Basic for Applications (VBA) editor.

2
Locate API Declarations

Find the modules containing your Windows API calls, specifically the Declare statements for 'GetOpenFileName' and 'PathStripPath'.

3
Update to LongPtr

Check the arguments and return types. Change any 'Long' data types that represent window handles (HWND) or memory pointers to 'LongPtr'.

4
Save and Debug

Click 'Debug' in the top menu, then select 'Compile Database' to ensure no syntax errors remain. Save the module and test the file dialog.

Update Windows API Declarations for 64-bit Compatibility
Reference Documentation: Consult Microsoft's official VBA 64-bit compatibility guidelines for a complete list of API parameters that require the LongPtr update.
Free Microsoft Office alternative

Looking for a Lightweight, Reliable Office Suite?

While WPS Office does not include a database management tool like Microsoft Access, it offers a robust, free alternative for Word, Excel, and PowerPoint. If complex Office upgrades and API compatibility issues are causing headaches, switch to WPS Office for a seamless, lightweight document processing experience.

  1. 1. Download the Installer: Visit the official WPS Office website and download the free suite for your device.
  2. 2. Open Your Files: Launch WPS Office and directly open your existing DOCX, XLSX, and PPTX documents.
  3. 3. Work Seamlessly: Enjoy full format compatibility without worrying about macro breakdowns in your standard office files.
Free, lightweight, and fast alternative to Microsoft Office.Highly compatible with Microsoft Word, Excel, and PowerPoint formats.Avoid complex 32-bit and 64-bit VBA declaration issues for standard office tasks.Familiar user interface makes migration effortless for non-IT professionals.
microsoft office alternative - wps office

Frequently Asked Questions

What does PtrSafe mean in Access VBA?

The PtrSafe keyword asserts that an API Declare statement is safe to run in 64-bit VBA. However, adding PtrSafe only clears compile errors; you still must update relevant Long variables to LongPtr for the code to execute successfully.

Why did my VBA file dialog work before the Microsoft 365 upgrade?

Your previous installation (like Access 2016) was likely the 32-bit version. Upgrading to Microsoft 365 often installs the 64-bit version by default, which changes how memory pointers are handled and breaks 32-bit Windows API calls.

Can I roll back my Office version to fix the VBA issue?

Yes, rolling back to an older build or specifically installing the 32-bit version of Office can temporarily resolve the issue. However, updating your VBA code to support 64-bit is the recommended long-term solution.