+ Reply to Thread
Results 1 to 7 of 7

Insert signature image - password protected

Hybrid View

  1. #1
    Registered User
    Join Date
    01-31-2008
    Posts
    4

    Insert signature image - password protected

    I am trying to create a monthly checklist
    When an item on the checklist is completed, I want to insert a signature image - (.jpg file)

    Is there a way to:

    Prompt for a password when the user tabs into a cell

    and

    Based upon the password, insert the corresponding signature image.

    Example:

    John Doe tabs into a cell, it prompts for his password, he enters the password and the image of his signature appears.

    Jane Doe tabs into a cell, it prompts for her password, he enters the password and the image of her signature appears.

    A person should not be able to cut and paste the signature image after it is inserted.
    There maybe multiple signatures on the sheet through the course of a month.

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591
    Hi

    This needs some work, but may get you started.

    1) Build a user form that contains a textbox, and a commandbutton. Select a character for the passwordchar property in the textbox.

    2) Select the command button on the form and view code. Enter the following
    Private Sub CommandButton1_Click()
      Select Case TextBox1.Text
        Case "fred"
          pic = "C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Blue Hills.jpg"
        Case "sam"
          pic = "C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\sunset.jpg"
      End Select
      ActiveSheet.Pictures.Insert (pic)
      Unload Me
    End Sub
    3) Right click on the sheet tab, select view code and enter
    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
      If Target.Cells.Count = 1 And Target.Address = "$D$3" Then
        UserForm1.Show
      End If
        
    End Sub

    Now if you select D3 on the current sheet, it should raise the userform. If you enter fred or sam in the textbox, and press the button, it should bring in the picture (if the relevant picture exists at that path....).

    I didn't try to put a size on the picture, or name the picture, or delete any existing picture (hence the need to name any picture that you insert so you know what to delete).

    HTH

    rylo
    Last edited by rylo; 01-31-2008 at 07:01 PM.

  3. #3
    Registered User
    Join Date
    01-31-2008
    Posts
    4
    Well, that works great and I can work with it... (I am just learning this...)

    Now, can the cell be protected so the image cannot be copy and pasted?

    and

    Is there a way to give a message when an incorrect password is used?

    Will the image be imbedded so it will appear on other computers that do not contain the image file?

  4. #4
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591
    Hi

    1) The only way I know to protect the picture is to protect the sheet. If you do that, then you will have to include the protection on/off in your code.

    2) I've enhanced the code to (a) include an error message and (b) to remove any previous entry before bringing in a new one.

    Private Sub CommandButton1_Click()
      pic = ""
      On Error Resume Next
      Set oldpic = ActiveSheet.Pictures("Sign")
      On Error GoTo 0
      If Not IsEmpty(oldpic) Then oldpic.Delete
      
      Select Case TextBox1.Text
        Case "fred"
          pic = "C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Blue Hills.jpg"
        Case "sam"
          pic = "C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\sunset.jpg"
        
      End Select
      If pic = "" Then
        MsgBox "Incorrect Password"
        TextBox1.Text = ""
        TextBox1.SetFocus
      Else
        ActiveSheet.Pictures.Insert(pic).Select
        Selection.Name = "Sign"
        Range("D3").Select
        Unload Me
      End If
      
    End Sub
    3) Ahhh... Don't know. How about trying it. If it doesn't copy across, then perhaps build a sheet that contains all the images (protect, hidden etc) and then the code could copy it in from the "images" sheet. I would imagine that it would add to the file size though....

    rylo

  5. #5
    Registered User
    Join Date
    01-31-2008
    Posts
    4
    rylo, what you have given me is very much what I need but I need to add a little more functionality.

    I have attached a sample sheet as an example... (with no code)

    I need to have a check box in one column, insert the current date in the next column.

    Furthermore, I would like the person to be able to check multiple boxes on various lines and then, upon clicking an "Insert Signature" Block, the corresponding lines be populated with the signature image.

    I need to protect the signature image column, I have had no success on that.
    Attached Files Attached Files

  6. #6
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591
    Hi

    Rather than having a button, how about using an event from the checkbox. When it is selected, it asks for the password. If this is OK, then it populates the next column with the current date / time and inserts the signature. You should be able to adapt the existing code to do that.

    Means that each one is done individually, but as you seem to have different names, then I imagine that would be the preferred option. If the same user does more than 1 item then they would have to go through the same thing for each click.

    How does that sound?

    rylo

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1