VBA & Macro Problems

Fix Access VBA Shell Commands That Do Not Open Folders on Other Drives

Olivia MillerOlivia Miller Nov 25, 2026 868 views

Question details

The user needs an Access VBA Shell command to open a folder on a drive other than C:.

Fix Access VBA Shell Commands That Do Not Open Folders on Other Drives
Product
Microsoft Access
Device & OS
Windows
Scenario
An Access VBA procedure uses Shell to launch File Explorer with a folder path.
Observed behavior
Folders on the C: drive open, but paths on other drives may open the wrong location or return an error.
Before you start

Open the target folder in File Explorer to confirm that the path exists and is accessible. In Access, open the VBA editor and locate the Shell statement that launches Explorer.

Solution 1Recommended

Quote the Complete Folder Path in the Access VBA Shell Command

Use balanced quotation marks so Explorer receives the complete folder path, including paths with spaces.

1
Open the VBA procedure

In Access, press Alt+F11 and open the module containing the Shell command.

2
Correct the command

Replace the existing call with: Shell "explorer.exe """ & strFolderPath & """", vbNormalFocus. The doubled quotation marks in VBA put quotes around the value of strFolderPath.

3
Test the target path

Set strFolderPath to the full folder path, such as F:\Folder, and run the procedure. For a fixed path, you can use: Shell "explorer.exe ""F:\Folder""", vbNormalFocus.

Quote the Complete Folder Path in the Access VBA Shell Command
Open rather than select: The examples open the folder itself. Explorer's /select option instead selects a specified item in its parent folder.
Free Microsoft Office alternative

Work With Office Documents in WPS Office

WPS Office is a free, lightweight alternative for documents, spreadsheets, and presentations, with a familiar interface and support for common Microsoft Office formats to ease migration. It does not fix Access VBA Shell commands or replace Microsoft Access databases.

Free, lightweight tools for everyday office workCompatibility with Microsoft Office formats including DOCX, XLSX, and PPTXA familiar interface for working with existing Office filesKeep using Access for its databases and VBA while using WPS for other office documents
microsoft office alternative - wps office

Frequently Asked Questions

Why does Explorer open the wrong folder from my VBA command?

An unbalanced quotation mark can make the path invalid or cause Explorer to interpret it incorrectly. In the VBA editor, check that the Shell command places opening and closing quotes around the complete folder path.

Do folder paths with spaces need quotation marks?

Yes. Quote the complete path passed to Explorer. In VBA, use doubled quotation marks within the string, as in Shell "explorer.exe """ & strFolderPath & """", vbNormalFocus.

Can the same command open a network folder?

Yes. Set strFolderPath to the full UNC path, such as \\server\share\folder, and use the quoted Shell command. First paste the path into File Explorer to confirm that the Windows account can access it.

What should I check if the quoted path still fails?

Open the path directly in File Explorer, verify that any mapped drive is available, and check the folder's Properties > Security > Advanced settings for the account running Access.