none
VBA no longer loads an image RRS feed

  • Question

  • When I upgraded to Excel 2013 from 2003, the following code now gives me Run-time error 1004: Unable to get the Object property of the OLEObject class. The intent is to simply load a file image into an Image object in a spreadsheet. The Image objects exist, the file exists, and code to alter their position, width, etc works fine. For some reason the .object.picture or even .object.autosize give this error after the upgrade.

    Set ole = Config_Sheet.OLEObjects(myimage)
        With ole
            .Object.Picture = LoadPicture(image_filename)

        End With

    Thursday, January 1, 2015 7:10 PM

All replies

  • There is nothing wrong with the code, it should work fine in Excel 2013 assuming the sheet and object are referenced as expected,  and the filename exists.

    Can you insert a new image control OK, is so try with the new object. If not, search your system for all MSForms.exd, delete all or rename say *.exd.old and try again. Might need to close and restart Excel.

    Thursday, January 1, 2015 11:12 PM
    Moderator