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".
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
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!
 
Upvote 0

Forum statistics

Threads
1,214,515
Messages
6,119,973
Members
448,933
Latest member
Bluedbw

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