Run-Time 1004

DannyDont

New Member
Joined
Mar 7, 2014
Messages
40
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

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:

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
"Unable to get the Insert property of the Picture class". This usually means Excel cannot find the picture file to insert. So, double check the path and file name.
 
Last edited:
Upvote 0
How is the car that doesn't import LABELLED
 
Upvote 0
Ahha,

I have a image with a name of 'MB&S-4503.jpg' ... I get the run-time error when I attempt to insert this particular image. Excel / Windows let's me save with this name but can't find it for the insert. I know that you should not use 'special' characters in names but just didn't think about it when Windows was able to save it that way. This MB&S is a Road Name for a railroad. There are many railroads with the '&' in their acronym. Any suggestions on what I might do. This code will be used by many others and I want it to be SIMPLE! They will be taking pictures of the railroad cars and then saving them for use with my program. The two pieces of information that uniquely identify a particular car are Road Name and Car Number. Not being able to use the '&' will be sort of a problem. So thoughts are greatly appreciated.

Thanks for your help. I am going to go back and fill all of my potential 'sections' with the same car. That is how I found this particular issue. If you do not have any suggestions on what to do for the '&' then I will consider this issue closed.

Thanks again!
 
Upvote 0
might try underscore _ as the ampersand & works to conjoin values
 
Upvote 0

Forum statistics

Threads
1,214,911
Messages
6,122,195
Members
449,072
Latest member
DW Draft

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top