judgejustin
Board Regular
- Joined
- Mar 3, 2014
- Messages
- 150
I have a form that requires pictures to be placed in it. I have added a button and assigned the following macro to set the size and placement of the picture I need. It works great, except the height does not fit correctly. It seems the height is being controlled by the aspect ratio of the pictures. The pictures are all in different original dimensions and each time one is selected it will appear in the correct place with the correct width but not the correct height.
Am I missing something? Can someone, that is much better than I am, give me a suggestion?
It may not be the aspect ratio that is just the only thing that seems to make sense to me.
Thanks
Sub Button1_Click()
Dim myFiles, e
myFiles = Application.GetOpenFilename(, , , , True)
If Not IsArray(myFiles) Then Exit Sub
For Each e In myFiles
With ActiveSheet
With .Pictures.Insert(e)
.Left = Range("a1:a15").Left
.Top = Range("a1:f1").Top
.Height = Range("a1:a15").Height
.Width = Range("a1:f1").Width
End With
End With
Next
End Sub
Am I missing something? Can someone, that is much better than I am, give me a suggestion?
It may not be the aspect ratio that is just the only thing that seems to make sense to me.
Thanks
Sub Button1_Click()
Dim myFiles, e
myFiles = Application.GetOpenFilename(, , , , True)
If Not IsArray(myFiles) Then Exit Sub
For Each e In myFiles
With ActiveSheet
With .Pictures.Insert(e)
.Left = Range("a1:a15").Left
.Top = Range("a1:f1").Top
.Height = Range("a1:a15").Height
.Width = Range("a1:f1").Width
End With
End With
Next
End Sub