Footer question

O

Office_Novice

I have been stuck on this for awhile. I have a form that that has a routing
slip, what happens is when a user completes the form, it adds the application
user name as the footer, and then it is emailed using the routing slip. When
the recipient opens the form the footer becomes the recipients Application
username. I would really like the initial user’s application user name to
remain the footer any ideas? Here is what i have been working with...

Sub Footer()
Dim myRange As Range
Set myRange = ActiveDocument.Sections(1).Footers(1).Range

myRange.Fields.Add Range:=myRange, Type:=60
End Sub
 
J

Jay Freedman

Office_Novice said:
I have been stuck on this for awhile. I have a form that that has a
routing slip, what happens is when a user completes the form, it adds
the application user name as the footer, and then it is emailed using
the routing slip. When the recipient opens the form the footer
becomes the recipients Application username. I would really like the
initial user's application user name to remain the footer any ideas?
Here is what i have been working with...

Sub Footer()
Dim myRange As Range
Set myRange = ActiveDocument.Sections(1).Footers(1).Range

myRange.Fields.Add Range:=myRange, Type:=60
End Sub

To prevent a field from updating, you can unlink it (turn it into plain
text). Try it this way -- and note that the '60' value has a name that helps
the macro to document what it's doing:

Sub Footer()
Dim myRange As Range
Dim myField As Field
Set myRange = ActiveDocument.Sections(1).Footers(1).Range

Set myField = myRange.Fields.Add(Range:=myRange, Type:=wdFieldUserName)
With myField
.Update
.Unlink
End With
End Sub

Another alternative is to lock the field -- that is, it's still a field but
updating it won't have any effect until you unlock it. To do that, replace
the .Unlink line with .Locked = True .

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
O

Office_Novice

Thanks Jay, I think that will do perfectly.

Jay Freedman said:
To prevent a field from updating, you can unlink it (turn it into plain
text). Try it this way -- and note that the '60' value has a name that helps
the macro to document what it's doing:

Sub Footer()
Dim myRange As Range
Dim myField As Field
Set myRange = ActiveDocument.Sections(1).Footers(1).Range

Set myField = myRange.Fields.Add(Range:=myRange, Type:=wdFieldUserName)
With myField
.Update
.Unlink
End With
End Sub

Another alternative is to lock the field -- that is, it's still a field but
updating it won't have any effect until you unlock it. To do that, replace
the .Unlink line with .Locked = True .

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top