W
Wayne Butterworth
Hi,
I'd like to update all of the fields in my document when the doc is opened. To do this, I have put ActiveDocument.Fields.Update in the AutoOpen() macro.
This works, except for the fields that are dependant on the number of pages in the document.
By examining the value of the "Number of pages" property in ActiveDocument.BuiltInDocumentProperties when the macro runs, I see that the number of pages is 3 ( there are actually 26 in my test document ) when the macro runs. If I manually run the macro, the number of pages in this property is correct.
I also found that if I stop the macro for a few seconds, eg by putting a Stop or breakpoint in, the Number of pages property gets updated correctly ( at the same time, I can see the scrollbar changing to reflect the increasing length of the document ).
So, it seems that the AutoOpen() macro runs after the document is loaded into memory ( the full contents are available to the macro ), but before the document is rendered. Is there a way to run a macro after the document is rendered / pagination is finished, or to pause AutoOpen() without user action to restart? Or is there perhaps a better way to update these fields?
thanks,
Wayne.
Submitted via EggHeadCafe - Software Developer Portal of Choice
WPF Datagrid as ComboBox Dropdown Part 2
http://www.eggheadcafe.com/tutorial...96-e24127040bbf/wpf-datagrid-as-combobox.aspx
I'd like to update all of the fields in my document when the doc is opened. To do this, I have put ActiveDocument.Fields.Update in the AutoOpen() macro.
This works, except for the fields that are dependant on the number of pages in the document.
By examining the value of the "Number of pages" property in ActiveDocument.BuiltInDocumentProperties when the macro runs, I see that the number of pages is 3 ( there are actually 26 in my test document ) when the macro runs. If I manually run the macro, the number of pages in this property is correct.
I also found that if I stop the macro for a few seconds, eg by putting a Stop or breakpoint in, the Number of pages property gets updated correctly ( at the same time, I can see the scrollbar changing to reflect the increasing length of the document ).
So, it seems that the AutoOpen() macro runs after the document is loaded into memory ( the full contents are available to the macro ), but before the document is rendered. Is there a way to run a macro after the document is rendered / pagination is finished, or to pause AutoOpen() without user action to restart? Or is there perhaps a better way to update these fields?
thanks,
Wayne.
Submitted via EggHeadCafe - Software Developer Portal of Choice
WPF Datagrid as ComboBox Dropdown Part 2
http://www.eggheadcafe.com/tutorial...96-e24127040bbf/wpf-datagrid-as-combobox.aspx