View Single Post
 
Old 02-13-2023, 12:25 PM
Ddadoo57 Ddadoo57 is offline Windows 11 Office 2021
Advanced Beginner
 
Join Date: Feb 2023
Posts: 90
Ddadoo57 is on a distinguished road
Default

Quote:
Originally Posted by gmayor View Post
It sounds like you are selecting something in the header/footer ranges rather than using the ranges to make changes. If you use the code I posted there is no selection involved and the screen display should not change . The update merely shows the field result.


I inserted the following lines, at the beginning and end of the procedure, solves the problem for 98% ;-)

Application.ScreenUpdating = False
ActiveDocument.ActiveWindow.View.SeekView = wdSeekCurrentPageFooter
...
ActiveWindow.View.Type = wdNormalView
ActiveWindow.View.Type = wdPrintView

It works, but from time to time I have a small right and left of the document (not of the window nor of the tab) at the insertion of the footers. I insert or delete the footers through a checkbox.

In the procedure AutoNew() and OnLoad(ribbon As IRibbonUI), I don't have any Selection, I only have Ranges. I don't seem to have any other procedure or function called when creating or opening the document.

Sincerely,
David
Reply With Quote