- 帖子
- 976
- 主題
- 7
- 精華
- 0
- 積分
- 1018
- 點名
- 0
- 作業系統
- Win10
- 軟體版本
- Office 2016
- 閱讀權限
- 50
- 性別
- 男
- 註冊時間
- 2013-4-19
- 最後登錄
- 2025-1-10
|
14#
發表於 2021-4-16 11:43
| 只看該作者
回復 12# Muffledsatyr
請測試看看,不太了解是不是你要的結果,謝謝
Sub tt2()
Dim PicList, PicFormat$, Rng As Range, sShape As Shape, i&, X%, Y%
PicList = Application.GetOpenFilename(PicFormat, MultiSelect:=True)
X = 1
If IsArray(PicList) Then
For i = 1 To UBound(PicList)
Y = Y + 1
If Y > 5 Then X = X + 1: Y = 1 '5張換下一列
Set Rng = Cells(X, Y)
Cells(X, Y).ColumnWidth = 42 '設定excel寬度
Cells(X, Y).RowHeight = 170 '設定excel高度
Set sShape = ActiveSheet.Shapes.AddPicture(PicList(i), msoFalse, msoCTrue, Rng.Left, Rng.Top, 7.72, 5.79) '數字可設定照片寬高
Next
End If
End Sub |
|