Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

Error message when you run a VBA macro that uses the "Insert" method or the "AddPicture" method to insert a picture in Excel 2007: "Application-defined or object-defined error"


View products that this article applies to.

Symptoms

You run a Microsoft Visual Basic for Applications (VBA) macro that uses the Insert method or the AddPicture method to insert a picture in a worksheet in Microsoft Office Excel 2007. When you do this, the picture is not inserted. Additionally, you receive the following error message:
Run-time error '1004':

Application-defined or object-defined error

↑ Back to the top


Cause

This issue may occur if the picture is located in an HTTP location.

↑ Back to the top


Workaround

To work around this issue, code the VBA macro to insert the picture as a picture fill in a shape such as a rectangle.

↑ Back to the top


Keywords: KB928983, kbexpertisebeginner, kbvba, kbgraphic, kbprb, kbautomation, kbprogramming, kbmacro, kbtshoot, kberrmsg

↑ Back to the top

Article Info
Article ID : 928983
Revision : 3
Created on : 10/15/2007
Published on : 10/15/2007
Exists online : False
Views : 223