Microsoft
Software
Hardware
Network
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
Random Solutions
help, need recover files on HD, accident format
Calling MS-Dos.exe
RUBY - Read and write to file - selected rows
Change the Licensing Mode to Remote Desktop for Administration?
Unix Script for getting PID of process if Kernel exceeds 80%
Public Folders - Can't create recurring appointment, yet has full permissions. Only user to experience error.
Enable Parent Paths on Apache
Windows 98 SE, screen savers, and hard drive crashes
Using 7-zip from command line. Has anybody done it?
making external usb hardrive bootable for xp pro