- 帖子
- 29
- 主題
- 7
- 精華
- 0
- 積分
- 42
- 點名
- 0
- 作業系統
- XP
- 軟體版本
- OFFICE 2003
- 閱讀權限
- 10
- 註冊時間
- 2012-9-22
- 最後登錄
- 2013-1-9
|
在A2輸入檔名將圖片顯示在B2
能使用萬用字元嗎?
例如:檔名為ABCDEFG.JPG我在A2輸入ABC也能顯示ABCDEFG的圖片
以下是我的程式碼
請問該如何改呢
Sub Macro1()
j = 2
While Cells(j, "A") <> ""
NN = Cells(j, "A")
Cells(j, "B").Select
On Error Resume Next
ActiveSheet.Pictures.Insert("D:\My Pictures" & NN).Select
Selection.ShapeRange.LockAspectRatio = msoTrue
Selection.ShapeRange.Height = 100#
Selection.ShapeRange.Width = 100#
Selection.ShapeRange.Rotation = 0#
With Selection
.Placement = xlMoveAndSize
.PrintObject = True
End With
j = j + 1
Wend
Range("A2").Select
End Sub |
|