I need some help asap. I currently have this code that inserts some pictures, resizes them, etc. However, it seems like they are being inserted as an object not a picture. So if the folder name is changed, the pictures are not showing up in the report. Can someone point me in the direction of changing the code so that the pictures will be inserted as pictures, not as objects?
Thanks in advance.
Thanks in advance.
Code:
Sub InsertPictures()
Dim i As Long
Dim rngDest As Range
Dim arrPics() As String
Dim objPic As Object
DisableScreen
With Application.FileDialog(msoFileDialogFilePicker)
.AllowMultiSelect = True
.Filters.Clear
.Filters.Add "Images", "*.gif; *.jpg; *.jpeg"
.InitialFileName = CurDir
.FilterIndex = 2
If .Show = -1 Then
For i = 1 To .SelectedItems.Count
ReDim Preserve arrPics(1 To i)
arrPics(i) = .SelectedItems(i)
Next
Else
EnableScreen
Exit Sub
End If
End With
Set rngDest = Range("A65536").End(xlUp).Offset(7, 0)
For i = 1 To UBound(arrPics)
Set objPic = ActiveSheet.Pictures.Insert(arrPics(i))
With objPic
.Placement = xlMoveAndSize
.ShapeRange.LockAspectRatio = msoTrue
.ShapeRange.Width = 215#
.Left = rngDest.Left
.Top = rngDest.Top
End With
Set rngDest = rngDest.Offset(1 + (objPic.Height \ 20))
Next
EnableScreen
Exit Sub
End Sub