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

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
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,224,818
Messages
6,181,152
Members
453,021
Latest member
Justyna P

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