PopeScooby
New Member
- Joined
- Aug 13, 2024
- Messages
- 3
- Office Version
- 365
- 2021
- 2007
- Platform
- Windows
I need help solving the following error, "Run-Time error '-2147467259 (80004005)': Method 'InsertPictureInCell' of object 'Range' failed", and was hoping someone here could help. I have a program in Visual Studio that is opening an Excel Template, adding data, and then running some very simple VBA code in template's Module1. The VBA code is as follows...
Sub CellImage_Load(ImgCell, ImgPath)
Range(ImgCell).Select
Range(ImgCell).InsertPictureInCell (ImgPath)
End Sub
everything works fine until the line, "Range(ImgCell).InsertPictureInCell (ImgPath)", which produces the referenced error.
If I debug the error and try to run the code it will continue to error, however if I manually load one of the images and then re-test the same piece of code on a the same or a different row, it works fine. Hoping for any insight someone might be able to supply.
Sub CellImage_Load(ImgCell, ImgPath)
Range(ImgCell).Select
Range(ImgCell).InsertPictureInCell (ImgPath)
End Sub
everything works fine until the line, "Range(ImgCell).InsertPictureInCell (ImgPath)", which produces the referenced error.
If I debug the error and try to run the code it will continue to error, however if I manually load one of the images and then re-test the same piece of code on a the same or a different row, it works fine. Hoping for any insight someone might be able to supply.