10. 巨集程式視讀
Sub 按鈕1_Click()
!
On Error Resume Next
Dim Target As Range, FilPath As String
With ActiveSheet
FilPath = ThisWorkbook.Path & "photo" & .Cells(2, 4) & ".jpg"
.Pictures.Insert(FilPath).Select
'MsgBox (FilPath)
Set Target = .Cells(17, 9)
With Selection
.Top = Target.Top + 1
.Left = Target.Left + 1
.Width = Target.Width - 1
.Height = Target.Height - 1
End With
End With
End Sub
觀賞重點:
•FilPath:家系圖所在位置
•ThisWorkbook.Path:現在這個Excel檔所在位置
•cells(2,4):個案編號
•.jpg:圖檔只能⽤用.jpg,不能⽤用.png或.bmp之類的
!
- !9 -