Renaming inserted pictures in excel
<p>Pictures that are inserted in excel will automatically be named &quot;Picture 1&quot;, &quot;Picture 2&quot; and so forth. I'm running a function to put a border around the selected picture. Problem is, if there are two images in the worksheet that is &quot;Picture 1&quot;, the function will get confuse and not know which one to put it on but randomly put it on a image which could be incorrect. Is there anyway to change the name box of a image or at least get the selected image?</p>
<p>Here's my code to put border on image:</p>
<pre><code>Private Function AddImageBorder(WhichSheet As String)

    With ActiveWorkbook.Sheets(WhichSheet).Shapes(Selection.Name)
        .Line.Weight = 5
        .Line.Visible = msoTrue
    End With
    
End Function
</code></pre>