Creation of a sign-in sheet using Visual Basic forms

Aeonat

New Member
Joined
Sep 6, 2011
Messages
18
I have been trying to produce a typical sign-in sheet to capture signatures, names and dates - it should be fairly simple but I am hitting roadblocks.

I want a script that:
  1. displays a form with [InkPicture] for signature, [ComboBox] for selecting your name from a list, and [TextBox] for typing your name if it isn't on the list
  2. when pressing [CommandButton1] clears the form and records Signature, Name and Now() in the workbook on 'row' 1 (each person should be stacked). This button can be pressed multiple times to record multiple people.
  3. when pressing [CommandButton2] closes the form. If possible it would also PDF the sheet, but I can probably work out that bit.

I am struggling with the following:
  • I can't seem to declare a Strokes object in Dim... As Strokes
  • I therefore can't find a way to clear the InkPicture
  • I wanted to put a watermark containing the filename and date behind the signatures to make them more tamper-proof, but can't work out how to achieve it

I would be very grateful for any help. Below is my current code (try not to laugh) - it exists behind a form with [InkPicture], [ComboBox] referring to sheet "Names" Cells A1:A20 and Cell D1 has a count on A:A, [TextBox] and two [CommandButton].

Code:
Private Sub CommandButton1_Click()

Dim inkstep As Integer
inkstep = 2
Dim iRng As String
iRng = ""


InkPicture1.Ink.ClipboardCopy
iRng = "A" & CStr(inkstep) & ":E" & CStr(inkstep + Math.Round(InkPicture1.Height / 15, 0))
Worksheets(1).Paste Destination:=Worksheets(1).Range(iRng)
Worksheets(1).Cells(inkstep, 6) = TextBox1.Text
Worksheets(1).Cells(inkstep + 1, 6) = Format(Now(), "hh:mm, dd/MM/yyyy")


If TextBox1.Text <> ComboBox1.Text Then
    Worksheets("Names").Cells(Worksheets("Names").Cells(1, 4) + 1, 1) = TextBox1.Text
End If


ComboBox1.Text = ""
TextBox1.Text = ""
inkstep = inkstep + Math.Round(InkPicture1.Height / 15, 0)


End Sub
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top