How to Fix Run-time Error 13146 When Embedding PNG in Access OLE Object via VBA
Question details
The user needs to resolve run-time error 13146 that occurs when executing VBA code to embed a PNG file into an Access OLE Object column.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- Automating the process of converting an attachment into an OLE Object field using VBA scripting.
- Observed behavior
- The VBA code successfully attaches the image manually but fails with run-time error 13146 when programmatically attempting to embed a PNG file.
Verify that your Windows operating system has a default application associated with PNG files that functions as an OLE server, such as Microsoft Paint.
Link the PNG File Instead of Embedding
Modify the VBA code to link the PNG file instead of embedding it, which bypasses the OLE server limitation for this specific file format.
Certain image formats, like PNG, are not natively supported for OLE embedding depending on the system's registered OLE servers. Changing the OLE frame action from embedding to linking resolves the run-time error while still displaying the image.
Open your Microsoft Access database and press ALT + F11 to launch the Visual Basic for Applications (VBA) editor.
Find the specific line in your script where the action property is set to acOLECreateEmbed.
Replace acOLECreateEmbed with acOLECreateLink to instruct Access to link the external file.
Ensure that the SourceDoc property points to the correct, accessible file path of the PNG image.
Verify OLE Server Registration and File Association
Ensure the operating system has the correct OLE server associated with PNG files so Access can process the embedding command.
Explore WPS Office for Your Document Needs
While Microsoft Access handles databases, WPS Office is a perfect, free, lightweight, and easy-to-use alternative for all your Microsoft Word, Excel, and PowerPoint tasks. Experience a familiar UI and seamless migration today.

Frequently Asked Questions
Why does run-time error 13146 happen only with PNG files in Access?
Error 13146 typically occurs because Access relies on Windows OLE servers to embed objects. If the default application assigned to handle PNG files does not support OLE embedding natively, the VBA acOLECreateEmbed command will fail.
Can I manually embed a PNG into an OLE Object field without VBA?
Yes, manual embedding often works because the Access user interface handles the OLE wrapping differently. However, VBA interacts with the system's OLE server directly, which requires the application handling the PNG to fully support programmatic OLE embedding.
What is the difference between acOLECreateEmbed and acOLECreateLink?
acOLECreateEmbed stores a full copy of the file inside the Access database, which increases the total database file size. acOLECreateLink only stores a reference to the file's path on your computer, keeping the database smaller and avoiding certain OLE server limitations.




