Code needed to Electronically signing a form

canam

Board Regular
Joined
Dec 14, 2004
Messages
156
I am trying to take a paper Corrective Action form and change it to an Excel worksheet. The problem that I am running it to is that this form needs signed by various people in several locations.

What I would like to do is embed a button on the sheet next to each place that needs a signature. When pushed a box would open that would ask for a password. Depending on what password is entered a signature would be entered in the appropriate box. Each person would have there own password. If possible I would like to make it an actual image of their signature that appears.

An example of cell locations would be button embeded in A1 for signature needed in B1. Another button would be in A12 for a signature needed on B12 and so on. There would be 5 different locations where signatures are needed throughout the sheet.

If it isn't possible to use an actual image I think that using there name as text would be OK since only they would know the password to have it entered. Help with the code needed to do this would be greatly appreciated. Thank You
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
There would be several ways of doing this. With a password we really need a userform with textbox with PasswordChar property set to *. This uses a button on the form to run the code. Don't forget to password protect the project modules otherwise anyone can see the passwords.
Code:
Private Sub CommandButton1_Click()
    Dim MyPassword As String
    Dim MyRange As Range
    '-----------------------------------------
    Me.Hide
    '- NB. set TextBox 'PasswordChar' property to *
    MyPassword = TextBox1.Value
    Select Case MyPassword
        Case "pass1"
            ActiveSheet.Pictures.Insert("C:\TEST\signature1.bmp").Select
            Set MyRange = ActiveSheet.Range("B2")
        Case "pass2"
            ActiveSheet.Pictures.Insert("C:\TEST\signature2.bmp").Select
            Set MyRange = ActiveSheet.Range("B12")
    End Select
    '--------------------------------------------------------
    '- picture to cell
    With Selection
        .Left = MyRange.Left
        .Top = MyRange.Top
        .Width = MyRange.Width
        .Height = MyRange.Height
    End With
    '----------------------------------------------------
    '- finish
    Unload Me
End Sub
 
Upvote 0
Brian

I tried your code and nothing happened. Do I need to have something special in my textbox code?
 
Upvote 0
Brian- I figured out the problem. It was my fault. I setup the userform incorrectly. One thing i would like to change is that when a password is incorrect or doesn't exist I would like for a message box to say something like "password not valid". Your help is greatly appreciated. Thank you.
 
Upvote 0
Code:
'- previous code here
    Case Else
        MsgBox ("Invalid password")
        Exit Sub
    End Select      ' already there
 
Upvote 0
What am I doing wrong?

Instead of using images I would like to use text. I have not been able to get the code to work. I insert a command button and then insert the code listed above. I get an compile error that states METHOD OR DATA NOT FOUND. The visual basic editor highlights the Me.Hide. I am very new at this so, I must be missing something. Help is appreciated.
 
Upvote 0
Userform

Ok after a little reasearch I learned more.

So far I know I need to create a user form that has a label, textbox, and button. But after that I am lost. It would be nice to see an example.
 
Upvote 0
Do I need to create a module to...

OK that sounds simple. However, how do you apply the user form to an excel worksheet? Do I need to create a module?
 
Upvote 0

Forum statistics

Threads
1,207,260
Messages
6,077,352
Members
446,279
Latest member
hoangquan2310

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