Userform VBA InkPicture enters into the sheet (specific cell) as the user signature of the image

I am new to InkPicture, but I like to use it so that the user can insert a signature in the form.

I cannot save the inkpicture in the spreadsheet, it just enters it as 0 in the cell that I specify.

With UserForm1.InkPicture1.Picture = InkPicture1.Picture


End With

lrDep = Sheets("Deploy").Range("A" & Rows.Count).End(xlUp).Row 
Sheets("Deploy").Cells(lrDep + 1, "A").Value = TBox1.Text 
Sheets("Deploy").Cells(lrDep + 1, "B").Value = TBox2.Text 
Sheets("Deploy").Cells(lrDep + 1, "C").Value = TBox3.Text 
Sheets("Deploy").Cells(lrDep + 1, "D").Value = TBox4.Text 
Sheets("Deploy").Cells(lrDep + 1, "G").Value = InkPicture1.Ink 

Can someone please help me. Thank.

0
source share
1 answer

I when through something like that some time ago.

You can see my question here .

, , , InkPicture .

UserForm ( , ) UserForm Signature_pad, - Private Sub Use_Click().

enter image description here

Userform:

Private Sub Use_Click()

    Dim objInk As MSINKAUTLib.InkPicture
    Dim bytArr() As Byte
    Dim File1 As String

    FilePath = Environ$("temp") & "\" & "Signature.png"

    Set objInk = Me.SignPicture

    If objInk.Ink.Strokes.Count > 0 Then
        bytArr = objInk.Ink.Save(2)
        Open FilePath For Binary As #1
        Put #1, , bytArr
        Close #1
    End If

    Signature.File = FilePath

    Unload Me
End Sub
Private Sub Cancel_Click()
    End
End Sub
Private Sub ClearPad_Click()
    Me.SignPicture.Ink.DeleteStrokes
    Me.Repaint
End Sub

Main sub ( Signature), , Sub button Sub.

'public temp file path
Public File
Sub collect_signature()

    'Dim and call userform
    Dim myUserForm As Signature_pad

    Set myUserForm = New Signature_pad
    myUserForm.Show
    Set myUserForm = Nothing

    'insert image/signature from temp file into application active sheet
    Set SignatureImage = Application.ActiveSheet.Shapes.AddPicture(File, False, True, 1, 1, 1, 1)

    'scale image/signature
    SignatureImage.ScaleHeight 1, True
    SignatureImage.ScaleWidth 1, True

    'image/signature position
    SignatureImage.Top = Range("A1").Top
    SignatureImage.Left = Range("A1").Left

    'delete temp file
    Kill File

End Sub

Userform Name, Buttons Name , buttons.

0

All Articles