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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Set User Info on MS Word Open

Status
Not open for further replies.

pbennett

Programmer
May 10, 2002
1
GB
Hello Everyone.

I work in a small office where several people work on the same document, but use the same Windows logon ID. In order to keep track of who made changes to the document, I want to program a macro to run when the document is openned that asks them to enter their name, initials, etc., and then put that information in the Application.UserName and Application.UserInitials fields.

I can't figure out how to bring up a dialog box on startup to do this. Can anyone help?

Thanks.

Phil
 
One thing is to make certain that you don't have Word Security set too High - Macros Disabled. Look under the tools, Macro, Security ... menu



Private Sub Document_Open()
Dim prmptUser As String
Do
prmptUser = InputBox("Please Enter Your Full Name")
If prmptUser <> &quot;&quot; Then
Application.UserName = prmptUser
Exit Do
End If
Loop
Do
prmptUser = InputBox(&quot;Please Enter Your Initials&quot;)
If prmptUser <> &quot;&quot; Then
Application.UserInitials = prmptUser
Exit Do
End If
Loop
'Note you can also create custom properties that can
'be set in the same manner.
'Me.CustomDocumentProperties(&quot;LastUser&quot;) = prmptUser
'Me.CustomDocumentProperties(&quot;Department&quot;) = prmptUser
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top