Fix Access VBA Error: Cannot Find Excel Attachment File
Question details
The user needs to resolve a runtime error in an Access database application where a VBA script fails to find and attach a newly generated Excel workbook to an Outlook email, triggered by a new sensitivity label requirement.
- Product
- Microsoft Access / Excel / Outlook
- Device & OS
- not provided
- Scenario
- Automating the creation of an Excel workbook on a network drive from an Access database and attaching it to an Outlook email using VBA.
- Observed behavior
- The VBA process successfully opens the Outlook email but omits the attachment, returning the error message: "Cannot find this file. Verify the path and file name are correct."
Ensure you have read and write permissions to the designated network drive and verify the exact sensitivity label requirements mandated by your organization's IT policies.
Use a Pre-Labeled Excel Template
Bypass the VBA labeling limitations by creating a blank template that already contains the required sensitivity label.
When an organization mandates sensitivity labels, VBA scripts attempting to create and save new Excel workbooks from scratch will often fail to save the file to the disk. As a result, when the script tells Outlook to attach the file, the file does not actually exist at the specified path, throwing the runtime error. Using a pre-labeled template is the most robust workaround.
Open a new, blank Excel workbook on your computer and manually apply the required sensitivity label via the Home tab or File menu.
Save this labeled workbook as a template file (e.g., Template.xlsx) in your database folder or network drive where the Access application resides.
Update your VBA script to copy this template file to the target destination instead of creating a new workbook using 'Workbooks.Add'.
Have the code open the copied, labeled workbook, insert the imported text data, save the changes, and then pass the file path to the Outlook attachment method.
Utilize the Office SensitivityLabel API
Programmatically apply the sensitivity label directly through VBA code during the file creation process.
Verify Office Version Compatibility
Ensure the environment executing the code fully supports VBA sensitivity label APIs.
Experience Hassle-Free Macros with WPS Office
If strict enterprise labeling policies and Microsoft Office version discrepancies are breaking your legacy VBA workflows, consider WPS Office. It provides robust, highly compatible spreadsheet automation capabilities in a lightweight, accessible suite.
- 1. Download and Install: Get the free version of WPS Office from the official website and install it on your machine.
- 2. Open your macro-enabled file: Launch WPS Spreadsheet and open your .xlsm or .xls files directly without losing formatting.
- 3. Run your scripts: Access the Developer tab to manage and run your VBA macros efficiently.

Frequently Asked Questions
Why does Access VBA say 'Cannot find this file' right after creating it?
This error occurs when the Excel application is prevented from saving the file to your hard drive or network path. Recently implemented security policies, such as mandatory sensitivity labels, will silently block the save operation. When your code later attempts to attach the file to Outlook, the file doesn't actually exist at the specified path.
Can I apply Microsoft sensitivity labels directly using VBA?
Yes, but this typically requires newer Office versions like Microsoft 365. You can use the Office SensitivityLabel API to assign a specific label ID. However, older environments like Office 2016 might not support these API calls, leading to macro failures.
What is the best way to bypass sensitivity label prompts in automated Access macros?
The most reliable, version-independent method is to create a blank Excel template manually, assign it the required sensitivity label, and save it. You can then modify your Access VBA code to copy this template file and write data into it, completely bypassing the need to apply labels programmatically.




