Code:
Option Explicit
Dim fpath As String
Private Sub CommandButton2_Click()
Dim RetVal, base, i, picName, picPath, picNumber
picName = "Image" & picNumber & ".bmp"
ChDir (ActiveWorkbook.Path)
base = ActiveWorkbook.Path & "\"
picPath = base & picName
RetVal = Shell(base & "CommandCam.exe /filename """ & picPath & """", vbHide)
For i = 0 To 2
Application.Wait (Now + TimeValue("00:00:01"))
Next
fpath = picPath
Image1.Picture = LoadPicture(fpath)
End Sub
Private Sub CommandButton1_Click()
Dim x As Long
Dim Y As Worksheet
Set Y = Sheets("Data1")
x = Y.Range("A" & Rows.Count).End(xlUp).Row
With Y
.Cells(x + 1, "A").Value = TextA.Text
.Cells(x+1,"B"). Value = Image1.Picture
.Cells(x + 1, "C").Value = TextC.Text
.Cells(x + 1, "D").Value = TextD.Text
.Cells(x + 1, "E").Value = TextE.Text
.Cells(x + 1, "F").Value = TextF.Text
.Cells(x + 1, "G").Value = TextG.Text
End With
Dim i As String
i = TextPart.Text
FileCopy fpath, "C:\\Users\HP\Desktop\Micro for Measurment\\" & i & ".JPG"
Me.TextPart.Text = ""
'clear the data
TextA.Text = ""
TextC.Text = ""
TextD.Text = ""
TextE.Text = ""
TextF.Text = ""
TextG.Text = ""
fpath = ""
Image1.Picture = LoadPicture("")
End Sub
Last edited by a moderator: