I'm using a "template.docx" to copy to my "newDoc.docx" to use some predefined styles or illustrations. But with this new content, i want to update fields and my table of contents, so it's easy to do it with a vba script, the user don't have to do anything.
But i have a problem, i juste want one execution at the first openning. But if i use the document_new method, my docx is not know as new.
So, how can i "set" it as a new file/doc when i copy it ?开发者_运维问答 Or maybe i must use a vba variable, modify it when update to prevent for the others updates ?
Thx all !
I generate the doc based on a docx with c# using open xml sdk.
Dim oStory As Range
Dim oField As Field
For Each oStory In ActiveDocument.StoryRanges
For Each oField In oStory.Fields
oField.Update
Next oField
Next oStory
but i wish to execute just one time for the first open.
精彩评论