Solved

Why does this VBA code crash Word

Posted on 2011-02-21
5
618 Views
Last Modified: 2013-11-25
Hi experts!

I wrote this macro to break up long pages, giving each new page the title and banner information of the previous page. It works great but after anywhere from five to ten uses, it crashes Word. Why is that and how do I correct it?

Thanks! BreakBanner.txt
0
Comment
Question by:Eddie_Aeffect
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 76

Assisted Solution

by:GrahamSkan
GrahamSkan earned 400 total points
ID: 34945636
When you say 'crashes', what exactly happens? Do you, for instance get any error messages?

Without a suitable document, it is hard to test or to guess exactly what you are trying to do, especially with extensive use of Selection movements, but I wonder if you could achieve your objective by using the Header rows facility of Word tables. Have you tried that?



0
 

Assisted Solution

by:Eddie_Aeffect
Eddie_Aeffect earned 0 total points
ID: 34955147
What happens is that after running the macro, I will get the message that Word has encountered a problem and Word will restart trying to recover from the error. It would certanly seem to be some sort of internal memory or buffer issue but I don't know how those work. Is there a command to clear out such memory or buffer?

As far as using any Header option, I know Excel has this but I don't think Word does but it wouldn't help anyway since my "header" is not part of the table.
0
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 400 total points
ID: 34957010
You could run the steps here in case your word installation has got itself corrupted.

http://support.microsoft.com/kb/921541

Could you consider making the data a part of the table? It could be quite different, and you needn't have borders, so that it wouldn't be seen as part of the table
Table-header.doc
0
 

Assisted Solution

by:Eddie_Aeffect
Eddie_Aeffect earned 0 total points
ID: 35012101
Hi GrahamSkan!

I put in a couple of lines of code that clear out the revisions and now it is not crashing. So I am good. Thanks for responding so quickly.
0
 

Author Closing Comment

by:Eddie_Aeffect
ID: 35045670
Thanks for trying to help. Have a great day!
0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The System Center Operations Manager 2012, known as SCOM, is a part of the Microsoft system center product that provides the user with infrastructure monitoring and application performance monitoring. SCOM monitors:   Windows or UNIX/LinuxNetwo…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
This video shows where to find templates, what they are used for, and how to create and save a custom template using Microsoft Word.
In a previous video Micro Tutorial here at Experts Exchange (http://www.experts-exchange.com/videos/1358/How-to-get-a-free-trial-of-Office-365-with-the-Office-2016-desktop-applications.html), I explained how to get a free, one-month trial of Office …

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question