Microsoft Office Tutorials and References
In Depth Information
Creating a Photo Album
'Insert the picture (use a small size then resize it later)¶
Set Shp = Sht.Shapes.AddPicture(.FoundFiles(i), False, _¶
True, Rng.Left, Rng.Top, 10, 10)¶
With Shp¶
'Resize it to its original size¶
.ScaleHeight 1#, msoTrue, msoScaleFromTopLeft¶
.ScaleWidth 1#, msoTrue, msoScaleFromTopLeft¶
'Make sure that when it is resized, it appears normally¶
.LockAspectRatio = True¶
'Move it to the specified range, just in case¶
.Left = Rng.Left¶
.Top = Rng.Top¶
'Resize it¶
.Width = Rng.Resize(, Size).Width¶
'Does it need to be resized?¶
If Shp.BottomRightCell.Row > Rng.Row + Size * 3 Then¶
.ScaleHeight 1#, msoTrue, msoScaleFromTopLeft¶
.ScaleWidth 1#, msoTrue, msoScaleFromTopLeft¶
.Height = Rng.Resize(Size * 3).Height¶
.Left = Rng.Left + Rng.Resize(, _¶
Size).Width / 2 - .Width / 2¶
End If¶
End With¶
Next i¶
End With¶
'Restore screen updating¶
Application.ScreenUpdating = True¶
End Sub¶
Exl
In the 'Change the following variables' section, the following four variables can
be changed:
Path:
The location of the pictures
¾
LookInSubFolders: Search in the subfolders as well (True or False)
¾
MaxClm:
Number of pictures to insert per row
¾
Size:
Width (in columns) of each picture
¾
Search JabSto ::




Custom Search