I have the code below. It works fine with photos taken in landscape but not with photos in portrait. How can I adjust so it just takes whatever photo? It doesn't really matter what the photo looks like in the spreadsheet just so you can see it, click on it, and open the original.
VBA Code:
Sub AddPictureNotInsert()
Dim strFileName As String
Dim objPic As Shape
Dim rngDest As Range
strFileName = Application.GetOpenFilename( _
FileFilter:="Images (*.jpg;*.gif;*.png),*.jpg;*.gif;*.png", _
Title:="Please select an image...")
If strFileName = "False" Then Exit Sub
Set rngDest = ActiveCell
Set objPic = ActiveSheet.Shapes.AddPicture(strFileName, False, True, 10, 10, -1, -1)
With objPic
.LockAspectRatio = msoFalse
.Left = rngDest.Left + 1
.Top = rngDest.Top + 1
.Width = rngDest.Width - 2
.Height = rngDest.Height - 2
End With
ActiveSheet.Hyperlinks.Add Anchor:=objPic, Address:=strFileName
End Sub