Select Pasted Picture

ktkelly_1

New Member
Joined
Jun 13, 2019
Messages
17
I am trying to rename a picture that I just pasted (a copied screenshot) so that way I can consistently copy and paste and modify using the same name. So far the code I have is this:

Application.SendKeys "({1068})", True
DoEvents


Dim PicName As Variant
PicName = "Cinco Bug All Screenshot1"
Sheets("Cinco Bugs").Activate
ActiveSheet.Shapes.Range(Array("Picture 1")).Delete
Range("A1").Select
ActiveSheet.Pictures.Paste
ActiveSheet.Shapes.Range(Array(PicName)).Select

The last two lines is where I would like to consistently rename the just pasted picture which my guess will have a different name every time it is pasted. Any suggestions?
I am also hoping I can adjust the new defined name of the picture with Pic Name and change the "Picture 1" (or inconsistent name when pasted) to the name defined in the variable "PicName".
 

Some videos you may like

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

Domenic

MrExcel MVP
Joined
Mar 10, 2004
Messages
19,452
Try...

Code:
Dim PicObj As Picture
Dim PicName As String


PicName = "Cinco Bug All Screenshot1"


With Sheets("Cinco Bugs")
    On Error Resume Next
    .Pictures(PicName).Delete
    On Error GoTo 0
    With .Pictures.Paste
        .Name = PicName
    End With
End With

Hope this helps!
 

Watch MrExcel Video

Forum statistics

Threads
1,126,895
Messages
5,621,491
Members
415,844
Latest member
Reda Fouad Ramzy

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
Top