Excel 也能做相簿!利用「插入圖片」→「連結檔案」不嵌入檔案體積、VBA 批量讀取資料夾照片自動排版、列印設定「調整至 1 頁寬」輸出相簿列印版,零成本打造個人化數位相簿。

Sub ImportPhotoAlbum()
Dim fDialog As FileDialog, fPath As String, fName As String
Dim ws As Worksheet, r As Long, c As Long, shp As Shape
Set fDialog = Application.FileDialog(msoFileDialogFolderPicker)
If fDialog.Show = -1 Then fPath = fDialog.SelectedItems(1) & "\"
Set ws = ActiveSheet
r = 1: c = 1
fName = Dir(fPath & "*.jpg")
Do While fName <> ""
Set shp = ws.Pictures.Insert(fPath & fName, False, True) ' 連結不嵌入
With shp
.ShapeStyle = msoShapeStylePreset1
.LockAspectRatio = msoTrue
.Width = 150 ' 統一寬度
.Top = ws.Rows(r).Top + 5
.Left = ws.Columns(c).Left + 5
End With
c = c + 1
If c > 4 Then c = 1: r = r + 10 ' 4欄換行,列高預留
fName = Dir
Loop
ws.Columns.AutoFit
End Sub