|
|
Question : Can I unlink DOCVARIABLES without unlinking other fields, or will my DOCVARIABLE values survive if I don't update and unlink
|
|
I have created a routine that takes values from a spreadsheet and substitutes these values in a Word document using DOCVARIABLES. The code I am using is as follows and it works perfectly: doc.Variables.Add Name:=strVNAme, Value:=fnNZ(xlSheet.Cells(r, c), "") When this is done I conclude by updating the variables and saving the document with the following code, which also does what I originally intended: Selection.WholeStory Selection.Fields.Update Selection.Fields.Unlink
After all this substitution is done I need to make some additions to the document that will then throw out the pagination and so I need to be able to update the TOC and other references in the document (its a 108 page document).
Is there any way of updating and unlinking only DOCVARIABLE values and not other references? Alternatively, will my DOCVARIABLE values be saved if I don't do the update and unlink? How do you suggest I handle?
|
Answer : Can I unlink DOCVARIABLES without unlinking other fields, or will my DOCVARIABLE values survive if I don't update and unlink
|
|
Try this
---------------------------------------------------------------------------------------- Dim myFld As Field
For Each myFld In ActiveDocument.Fields
If myFld.Type = 64 Then myFld.Update myFld.Unlink Next ---------------------------------------------------------------------------------------- This will update and unlink DOCVARIABLE fields
Hope, this is of some help to you
thanks,
GBahri
|
|
|
|
|