Private Sub UserForm_Initialize()
Dim imgpath As String
imgpath = ThisWorkbook.Path & "\" & "img"
Image1.Picture = LoadPicture(imgpath & "\" & "123.jpg")
End Sub
Private Sub UserForm_Initialize()
imgname = ActiveWorkbook.Sheets(1).Range("A1").Value
Dim imgpath As String
imgpath = ThisWorkbook.Path & "\" & "img"
If Dir(imgpath & "\" & imgname & ".jpg") = "" Then
MsgBox ("找不到圖面!!!")
Exit Sub
End If
Image1.Picture = LoadPicture(imgpath & "\" & imgname & ".jpg")
End Sub作者: s13030029 時間: 2019-7-23 09:25
已解決~~~~
Sub 顯示圖面()
imgname = ThisWorkbook.Sheets("製程模板").Range("I4").Value
Dim imgpath As String
imgpath = ThisWorkbook.Path & "\" & "圖面" '指定資料夾
If Dir(imgpath, vbDirectory) = "" Then MkDir imgpath
If imgname = "" Then
A = MsgBox("請先在計畫表輸入產品編號!!!", vbInformation, "提示訊息")
Exit Sub
Else
If Dir(imgpath & "\" & imgname & ".jpg") = "" Then
B = MsgBox("找不到圖面!!!,請確定圖面資料夾裡有該檔名", vbCritical, "提示訊息")
Exit Sub
Else
圖面.Show 0
End If
End If