I have used a reference VBA to embedded an image without linking
Now I'm trying to modify this program to select the image which got inserted.
Can anyone suggest the syntax for this and where to modify the program?
VBA Code:
Sub InsertImage()
Dim FullPathName as string
With Application.FileDialog(msoFileDialogFilePicker)
.AllowMultiSelect = False
.ButtonName = "Submit"
.Title = "Select an image file"
.Filters.Clear
.Filters.Add "JPG", "*.JPG"
.Filters.Add "JPEG File Interchange Format", "*.JPEG"
.Filters.Add "Graphics Interchange Format", "*.GIF"
.Filters.Add "Portable Network Graphics", "*.PNG"
.Filters.Add "Tag Image File Format", "*.TIFF"
.Filters.Add "All Pictures", "*.*"
If .Show = -1 Then
'''''' Store the pathname of selected image to a variable
FullPathName = .SelectedItems(1)
'''''' Imports image as embedded into Worksheet
Activesheet.Shapes.AddPicture filename:=FullPathName, _
linktofile:=msoFalse, savewithdocument:=msoCTrue, _
left:=300, _
top:=200, _
width:=150, _
height:=150
Dim Pic As shape
For Each Pic In ActiveSheet.Shapes
''''' Change "A1" to which ever cell this is being placed in
'If (Pic.left = Range("A1").left And Pic.top = Range("A1").top) Then
Pic.Select
Pic.LockAspectRatio = msoTrue
'End If
Next Pic
End If
End With
End Sub
Now I'm trying to modify this program to select the image which got inserted.
Can anyone suggest the syntax for this and where to modify the program?