Hi everybody. Thanks in advance for taking a look at my dilemma. I thought I figured out the code to insert a picture resized to fit into an area of merged cells (F10) so that it is centered within the area depending on if it is a horizontal or vertical picture. The user upgraded to Windows 10, so now when they insert a picture it is somewhat resized from the original picture (it's a little too big for cell F10), but it is now over in cell Q10! If they pick any pictures taken before the upgrade, the vba works fine and they get resized nicely to fit in F10.
VBA Code:
Dim Pic
Dim PicFormat$
Dim MyRange$
PicFormat = "All Image Files (*.bmp; *.gif; *.jpg; *.tif), *.bmp; *.gif; *.jpg; *.tif"
Pic = Application.GetOpenFilename(PicFormat)
If Pic = False Then End
Range("F10").Select
MyRange = Selection.Address
With ActiveSheet.Pictures.Insert(Pic)
With .ShapeRange
.LockAspectRatio = msoFalse
If .Width > .Height Then .Width = Range(MyRange).Width
If .Height > Range(MyRange).Height Then .Height = Range(MyRange).Height
Else
.LockAspectRatio = msoTrue
.Height = Range(MyRange).Height
.Left = Range(MyRange).Left + ((Range(MyRange).Width - .Width) / 2)
End If
End With
End With