Results 1 to 2 of 2

Thread: Select Pasted Picture
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    New Member
    Join Date
    Jun 2019
    Posts
    17
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Select Pasted Picture

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

  2. #2
    MrExcel MVP
    Join Date
    Mar 2004
    Location
    Canada
    Posts
    18,855
    Post Thanks / Like
    Mentioned
    35 Post(s)
    Tagged
    5 Thread(s)

    Default Re: Select Pasted Picture

    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!

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •