- 帖子
- 5923
- 主題
- 13
- 精華
- 1
- 積分
- 5986
- 點名
- 0
- 作業系統
- win10
- 軟體版本
- Office 2010
- 閱讀權限
- 150
- 性別
- 男
- 來自
- 台灣基隆
- 註冊時間
- 2010-5-1
- 最後登錄
- 2022-1-23
        
|
回復 9# basarasy
修改你1樓的程式如下-
- Private Sub Ex()
- Dim Ps, Pc, A
- With Application.FileDialog(msoFileDialogOpen)
- .Title = "尋找圖片檔"
- .AllowMultiSelect = True '多重選取檔案
- .ButtonName = "開啟圖片檔"
- .InitialView = msoFileDialogViewThumbnail
- .Filters.Add "Images", "*.gif; *.jpg; *.jpeg", 1
- .FilterIndex = 1
- If .Show = False Then
- MsgBox "沒有選擇任何圖片檔", vbOKOnly + vbExclamation: Exit Sub
- Else
- Set Ps = .SelectedItems
- End If
- End With
- Application.ScreenUpdating = False
- With Sheet3
- .Range("A2:d20000").Clear 'A2以下 清除 (全部)
- .Range("A2:d20000").EntireRow.AutoFit '恢復為標準列高
- .Pictures.Delete
- Set A = .Range("A2")
- For Each Pc In Ps
- A.Value = A.Row - 1
- .Hyperlinks.Add Anchor:=A.Cells(1, 3), Address:=Pc, TextToDisplay:=Pc
- With .Pictures.Insert(Pc)
- .Height = 34
- .Width = 54
- .Left = A.Offset(, 3).Left
- .Top = A.Offset(, 3).Top
- End With
- Set A = A.Offset(1)
- Next
- '.Shapes.SelectAll
- .Pictures.Placement = xlMoveAndSize
- .Range("a1:c1").EntireColumn.AutoFit '自動調整欄寬
- .Range("A2:a" & .Range("A2").End(xlDown)).RowHeight = 34 '設定列高
- End With
- Sheet1.Select
- Application.ScreenUpdating = True
- ActiveSheet.Range("A2").Select
- MsgBox "插入完成"
- End Sub
複製代碼 |
|