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?
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
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