B
Ben-8151
I have a spreadsheet that loads multiple tif images into a form based on the
file name. The original size of the tif images are 522x266. When the images
are imported they are resized to 77% Height, 62% Width. In Excel 2003 and
earlier the macro I created worked very well, the images were loaded and
resized. In Excel 2007, the images are imported but the size of the image is
incorrect. When I look at the properties of the picture the height is
correct, the width is incorrect. The aspect ratio of the picture is being
maintaned. Apparently in 2007 the Lock Aspect Ratio overides my custom
dimensions. I cannot figure out how to have the images load with a custom
size in Excel 2007. I can obviously select all of the images, remove the
lock aspect ratio setting and change the dimensions, but that takes time.
Here is the code I am using to import the image.
PictureForward: 'Load Forward files
Range("M18").Select
For PicI = 0 To 14
Sheets("Setup").Range("AP18") = PicI ' dev
If PicI = 6 Then 'Page 2
OffsetHeight = 65: OffsetCell = 5
End If
If PicI = 12 Then 'Page 3
OffsetHeight = 131: OffsetCell = 10
End If
If FDate(PicI) <> "" Then
insert_file = Cert_Dir & FDate(PicI)
Sheets("Setup").Range("O22") = insert_file ' dev
If Exten = ".gif" Then
ActiveSheet.Pictures.Insert(insert_file, xlTIF).Select
Else
ActiveSheet.Pictures.Insert(insert_file).Select
End If
Selection.Width = 245: Selection.Height = 155:
If (PicI / 2) - Int(PicI / 2) > 0 Then
Selection.Left = 290 'Right Picture
Selection.Top = TpFTif + OffsetHeight + (101 * (PicI - 1))
Cells((TpFTF + OffsetCell + (8 * (PicI - 1))), 13).Value =
FDate(PicI)
Else
Selection.Left = 27 'Left Picture
Selection.Top = TpFTif + OffsetHeight + (101 * PicI)
Cells((TpFTF + OffsetCell + (8 * PicI)), 8).Value = FDate(PicI)
End If
End If
Application.ScreenUpdating = False
Next PicI
Return
file name. The original size of the tif images are 522x266. When the images
are imported they are resized to 77% Height, 62% Width. In Excel 2003 and
earlier the macro I created worked very well, the images were loaded and
resized. In Excel 2007, the images are imported but the size of the image is
incorrect. When I look at the properties of the picture the height is
correct, the width is incorrect. The aspect ratio of the picture is being
maintaned. Apparently in 2007 the Lock Aspect Ratio overides my custom
dimensions. I cannot figure out how to have the images load with a custom
size in Excel 2007. I can obviously select all of the images, remove the
lock aspect ratio setting and change the dimensions, but that takes time.
Here is the code I am using to import the image.
PictureForward: 'Load Forward files
Range("M18").Select
For PicI = 0 To 14
Sheets("Setup").Range("AP18") = PicI ' dev
If PicI = 6 Then 'Page 2
OffsetHeight = 65: OffsetCell = 5
End If
If PicI = 12 Then 'Page 3
OffsetHeight = 131: OffsetCell = 10
End If
If FDate(PicI) <> "" Then
insert_file = Cert_Dir & FDate(PicI)
Sheets("Setup").Range("O22") = insert_file ' dev
If Exten = ".gif" Then
ActiveSheet.Pictures.Insert(insert_file, xlTIF).Select
Else
ActiveSheet.Pictures.Insert(insert_file).Select
End If
Selection.Width = 245: Selection.Height = 155:
If (PicI / 2) - Int(PicI / 2) > 0 Then
Selection.Left = 290 'Right Picture
Selection.Top = TpFTif + OffsetHeight + (101 * (PicI - 1))
Cells((TpFTF + OffsetCell + (8 * (PicI - 1))), 13).Value =
FDate(PicI)
Else
Selection.Left = 27 'Left Picture
Selection.Top = TpFTif + OffsetHeight + (101 * PicI)
Cells((TpFTF + OffsetCell + (8 * PicI)), 8).Value = FDate(PicI)
End If
End If
Application.ScreenUpdating = False
Next PicI
Return