Hi,
I have written a script to automate the creation of several documents. These documents were already written and I have resaved them into a template file with the appropriate bookmarks for code insertion etc. This all works like a charm.
The problem is that when I insert the template into a new document, a field is generated in the footer of the first page. However this field does not exist in the template (as far as i can tell), and it always resolves into an ugly error:
"Error! Unknown document property name."
across the bottom of all of the documents. When I click reveal code it shows the following:
{ if { docproperty mDocID } = "" "{FILENAME \p}" "{docproperty mDocID \* charFORMAT}" }
The following snippet of code shows the insert occuring:
' Create a new document
Documents.Add DocumentType:=wdNewBlankDocument
ChangeFileOpenDirectory "C:\autoDOC\templates\"
' Insert the template file into the new document
Selection.InsertFile FileName:=docType & ".dot"
How can I prevent this field from being inserted into the document?? is there some magical setting that i have missed in the template file - because this only occurs with some of the template files.
Thanks,
Ryan