Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Word2003 - Form - Require password to input data 1

Status
Not open for further replies.

Pompie1999

Technical User
Jan 22, 2008
6
US
I have a form in Word 2003. This is a Request For Change form that gets filled out whenever someone needs to make a change to controlled documents. The form requires several signatures from people who are scattered all over the plant. So far, we are printing the document and then sending it around for the appropriate signatures. I would like to 'fix' the current form so that each person who would normally sign it could input a password and it would just place their name in the appropriate signature field. This doesn't need to be fancy digital signatures or anything -- just something that would let you know that it is reasonable to assume that the person whose name appears in the various signature lines is the one who input the password. Is it possible to do that in Word? If not -- any suggestions? If so, how? Please.
 
Yes, it is possible. Although please note that it would not be, by any means, truly secure. Here is an example. This would be fired by a button on a toolbar, but you could do it in a few other ways.
Code:
Sub InsertSignature()
Dim PasswordList()
Dim Names()
Dim response As String
PasswordList = Array("r5^dazQ", "feD3#gg87Y", _
    "fred", "v4eRdT21")
Names = Array("H. Handel", "A. Einstein", _
    "Fred Flintstone", "R2D2")

response = Inputbox("Please enter your password.")

Case Select response
    Case "r5^dazQ"
        ActiveDocument.Bookmarks("SignField") _
             .Range.Text = Names(0)
    Case "feD3#gg87Y"
        ActiveDocument.Bookmarks("SignField") _
             .Range.Text = Names(1)
    Case "fred"
        ActiveDocument.Bookmarks("SignField") _
             .Range.Text = Names(2)
    Case "v4eRdT21"
        ActiveDocument.Bookmarks("SignField") _
             .Range.Text = Names(3)
    Case Else
        Msgbox "Sorry, that is not a valid " _
            & "password."
        [COLOR=red] ' then either loop back to
         'another Inputbox, or Exit totally.[/color red]
End Select
You did not state where you wanted the signature. I put it at a bookmark "SignField", but it coukld be where ever you want it to go.

This is just to hopefully give you an idea. Basically, you have an array of passwords that match to names.

PasswordList(0) matches to Names(0)
PasswordList(1) matches to Names(1)

etc.

Password is entered, its value tested using Select Case, and the matching value from Names used for the signature text.

There are definitely other ways to go about it.


faq219-2884

Gerry
My paintings and sculpture
 
Thanks for the reply and it sounds like it will do what I need. I'm sorry that I failed to mention where I wanted the signatures to be. I have several signature lines at the bottom of the form -- each with the expectation that someone with a specific role or title signs the document -- i.e., Education Coordinator, Training Coordinator, Engineer, etc. I would like the names to appear in the appropriate spot for that title.

So, does that mean that I would need to create several buttons and duplicate the code you supplied for each button?

Thanks for that quick reply.
 
So, does that mean that I would need to create several buttons and duplicate the code you supplied for each button?"

Absolutely not. You do NOT have to make several buttons. This is just a matter of logic. It can all be done with one button.
Code:
    Case "r5^dazQ"
        ActiveDocument.Bookmarks("TrainingCoordin") _
             .Range.Text = Names(0)
    Case "feD3#gg87Y"
        ActiveDocument.Bookmarks("EducationCoordin") _
             .Range.Text = Names(1)
    Case "fred"
        ActiveDocument.Bookmarks("Engineer") _
             .Range.Text = Names(2)
As I stated, I put my example at the bookmark "SignField", but "it could be where ever you want it to go".

faq219-2884

Gerry
My paintings and sculpture
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top