Hi. I have this code and it runs okay as long as I don't have too many pages with graphics on them. I can re-create the crash many times and would like to know if there is something else I can add to this so that the crash does not happen. Maybe something that will check when the page deletion process is taking longer than normal and the macro will pause to allow processing?
Dim s As Shape 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 pageThis
After some thought. I think I have a temporary solution that would work There needs to be a keypress listen, when SHIFT is pressed, macro will not run. I can use this to stop it from running until all pages are deleted and then I can let it run afterwards.
that would be great.
Having some trouble. I tried fiddling with this code and at a loss. any help would be appreciated.
Sub update()Dim pageThis As PageDim Shift As LongDim s As Shape If (Shift And 1) <> 0 Then Exit Sub 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 pageThis End Sub
tested this version of your macro on CD2019 and no crash (shift key not used)
Thank you Mek. The goal I have is to assign the shift key to stop the macro from running when I don't want it to. I can re-create the crashing with a specific document with over 100 pages of images and text. I'm not allowed to share that doc here.
this is killing me. started drinking now.