Hi. I have this macro called 'Update' and it will run through and renumber pages. However, If I click Undo in the tool bar it does not roll back to the point before the pages were all renumbered. Am I missing something?
code:
Sub update()Dim pageThis As PageDim s As ShapeActiveDocument.BeginCommandGroupOptimization = True For Each pageThis In ActiveDocument.Pages Set sPageNumThis = pageThis.Shapes.FindShape("pagetotal") If Not sPageNumThis Is Nothing Then sPageNumThis.Text.Story = CStr(ActiveDocument.Pages.Count) End If Next pageThisOptimization = FalseActiveDocument.EndCommandGroupEnd Sub
any ideas?
Just to let you know, I tested with X7 and it seemed to do/undo just fine. Only thing I'd add is the refresh code right after Optimization = False
ActiveWindow.Refresh
Do you see this problem if you just run the macro manually from the Scripts docker?
Or only when this sub is being called by some other sub?
This helps, thank you Myron.
Have not run it from the scripts docker, just called by another sub when I add or remove a page. I can't seem to recreated the issue now but adding '.Refresh' helps a little.