G
Greg Maxey
Hello Masters,
Yesterday I was working to help an OP find a solution for placing a
truncated file name and path in the footer of her document. The method that
I proposed was to use a DOCVARIABLE field. During testing I noticed that
after the docvariable is added to the document that an error is generated if
the code is run a second time. I thought that I would simply delete the
variable after it has served its purpose but then realized that if the user
updated fields then there would be no reference. My solution was an as
follows:
On Error Resume Next
ActiveDocument.Variables.Add Name:="Path", Value:=myString
ActiveDocument.Variables("Path").Value = myString
Which I figure will add the variable if it isn't there or skip the add line
and refresh if the variable is already in the document. Is this the correct
way?
Thanks
Yesterday I was working to help an OP find a solution for placing a
truncated file name and path in the footer of her document. The method that
I proposed was to use a DOCVARIABLE field. During testing I noticed that
after the docvariable is added to the document that an error is generated if
the code is run a second time. I thought that I would simply delete the
variable after it has served its purpose but then realized that if the user
updated fields then there would be no reference. My solution was an as
follows:
On Error Resume Next
ActiveDocument.Variables.Add Name:="Path", Value:=myString
ActiveDocument.Variables("Path").Value = myString
Which I figure will add the variable if it isn't there or skip the add line
and refresh if the variable is already in the document. Is this the correct
way?
Thanks