I have looked at some fixes for run-time error 1004 but can't seem to apply them to my situation.
I have merged six cells - i.e. A2-C4 - as a place to insert an image. (This is only as a guideline for where to place images. I realize I do not need to do the cell merge.) I then use the three cells (merged) of the next row for the "caption". I have three such "sections" per row and then a variable number of the same setup in rows below as needed. I have the image inserted in the proper place, resized and then adjusted to better fit the area for the images. However, after I insert several images I get the run-time 1004 error.
Also, I read that I should not need to do the "select" statement but again do not know how to apply it to my code. Thank you for your Help
NOTE: I just ran a test before sending. Here is what occurred.
Inserted Image at A2 (Merged cells A2-C4) - Success
Inserted Image at E2 (Merged cells E2-G4) - Success
Inserted Image at I2 (Merged cells I2-K4) - Success
Inserted Image at A7 (Merged cells A7-C9) - Success
Inserted Image at E2 (Merged cells E7-G7) - Success
Inserted Image at I7 (Merged cells I7-K9) - Run-time error '2004' error:
Unable to get the Insert property of the Picture class
I have merged six cells - i.e. A2-C4 - as a place to insert an image. (This is only as a guideline for where to place images. I realize I do not need to do the cell merge.) I then use the three cells (merged) of the next row for the "caption". I have three such "sections" per row and then a variable number of the same setup in rows below as needed. I have the image inserted in the proper place, resized and then adjusted to better fit the area for the images. However, after I insert several images I get the run-time 1004 error.
Also, I read that I should not need to do the "select" statement but again do not know how to apply it to my code. Thank you for your Help
NOTE: I just ran a test before sending. Here is what occurred.
Inserted Image at A2 (Merged cells A2-C4) - Success
Inserted Image at E2 (Merged cells E2-G4) - Success
Inserted Image at I2 (Merged cells I2-K4) - Success
Inserted Image at A7 (Merged cells A7-C9) - Success
Inserted Image at E2 (Merged cells E7-G7) - Success
Inserted Image at I7 (Merged cells I7-K9) - Run-time error '2004' error:
Unable to get the Insert property of the Picture class
Code:
' ********************************************************
' * Picture Macro *
' ********************************************************
Sub Picture1()
'
' Picture Macro
'
Dim CarToShow As String
Dim CellAddress As String
CellLocation = InputBox("Enter Cell Address 'an' ")
CarToShow = InputBox("Enter Car RN & Number as 'aaaa-nnnnnn' - No blanks: ")
Range(CellLocation).Select
ActiveSheet.Pictures.Insert( _
"C:\Users\Dan\JMRI\operations\csvManifests\ManifestFormatForDuncanCabassi-160505\" & CarToShow & ".JPG" _
).Select
Selection.ShapeRange.Height = 36 'Needs to be 36 for .5 inches high
Selection.ShapeRange.IncrementTop 5
Selection.ShapeRange.IncrementLeft 15
End Sub
Last edited: