gotmatt
08-12-2011, 08:15 AM
Hi all,
First off, thanks for all your help over the last month. This website and forum has been my classroom, and I've learned a ton! I'm finally done with my macro, but I still have one issue I cannot resolve. It's main function is to place headers and footers throughout the document. Their placement is variable, given different document structures, so two input boxes (StartSection and EndSection) are used to help guide the macro.
My issues is that it has intermittent issues. If I run it once, it may miss 2 headers, but if I start over and run it again, it works fine. Sometimes it misses more than that, and sometimes it comes out perfect. I notice that this is more prevalent with larger documents, and when the active window is in print/page view.
I'm thinking that word is being overloaded by it all. That sounds crazy to me, but if I step through it, it works fine. I've done everything I can think to lessen the processing...
ActiveDocument.Fields.Locked = True
Application.ScreenUpdating = False
Options.Pagination = False
but it still has issues. On a side note, after I declaire Options.pagination = False, and then call a subroutine, it still seems to paginate whether I want it to or not. :think:
Are there any more steps I can take to slow the macro down? Am I crazy to think my macro would work more reliably with less processes running?
Maybe I can close the document momentarily, run the macro, and then reopen it?
The portion that tends to mess up is part of a huge form, but it's called by a button. I'm including a Word document with the exact code that has trouble. It's a bit out of context, but it should give anyone a good idea of what I'm working with.
Thanks guys!
First off, thanks for all your help over the last month. This website and forum has been my classroom, and I've learned a ton! I'm finally done with my macro, but I still have one issue I cannot resolve. It's main function is to place headers and footers throughout the document. Their placement is variable, given different document structures, so two input boxes (StartSection and EndSection) are used to help guide the macro.
My issues is that it has intermittent issues. If I run it once, it may miss 2 headers, but if I start over and run it again, it works fine. Sometimes it misses more than that, and sometimes it comes out perfect. I notice that this is more prevalent with larger documents, and when the active window is in print/page view.
I'm thinking that word is being overloaded by it all. That sounds crazy to me, but if I step through it, it works fine. I've done everything I can think to lessen the processing...
ActiveDocument.Fields.Locked = True
Application.ScreenUpdating = False
Options.Pagination = False
but it still has issues. On a side note, after I declaire Options.pagination = False, and then call a subroutine, it still seems to paginate whether I want it to or not. :think:
Are there any more steps I can take to slow the macro down? Am I crazy to think my macro would work more reliably with less processes running?
Maybe I can close the document momentarily, run the macro, and then reopen it?
The portion that tends to mess up is part of a huge form, but it's called by a button. I'm including a Word document with the exact code that has trouble. It's a bit out of context, but it should give anyone a good idea of what I'm working with.
Thanks guys!