Trying to keep things as simple as possible the following stores the user
details in an ini file in the user templates folder. The first time the
macro is run it will prompt for the user details. These are then stored and
used to insert the data subsequently. The macro uses a message box to
confirm the details are correct and thus allows the user to change incorrect
details. You can save this as an autonew macro in the fax document template
or add it to a toolbar button.
Dim SettingsFile As String
Dim sUserName As String
Dim sEmail As String
Dim sTitle As String
Dim sCheck As String
On Error Resume Next
SettingsFile = Options.DefaultFilePath(wdUserTemplatesPath) &
"\Settings.ini"
sUserName = System.PrivateProfileString(SettingsFile, _
"ThisUser", "Name")
sEmail = System.PrivateProfileString(SettingsFile, _
"ThisUser", "Email")
sTitle = System.PrivateProfileString(SettingsFile, _
"ThisUser", "Title")
If sUserName = "" Then
GetUser:
sUserName = InputBox("Enter user's Name", "User Name", sUserName)
sTitle = InputBox("Enter user's title, if any", "User Title", sTitle)
sEmail = InputBox("Enter user's e-mail address", "User E-mail", sEmail)
System.PrivateProfileString(SettingsFile, "ThisUser", _
"Name") = sUserName
System.PrivateProfileString(SettingsFile, "ThisUser", _
"Email") = sEmail
System.PrivateProfileString(SettingsFile, "ThisUser", _
"Title") = sTitle
End If
sCheck = MsgBox("User is " & sUserName & vbCr & sTitle & _
vbCr & sEmail, vbYesNo, "Confirm User Details")
If sCheck = vbNo Then GoTo GetUser:
With Selection
.GoTo What:=wdGoToBookmark, name:="EMail"
.TypeText Text:=sUserName & vbTab & sEmail & vbCr & sTitle
End With
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
My web site
www.gmayor.com
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>