PDA

View Full Version : Solved: Supressing message boxes in Word 2003



murphy84
09-07-2007, 05:34 AM
Hi

Has anyone come across a problem with using the following:-

Application.DisplayAlerts = wdAlertsNone

I am receiving a message that says the following:-

"Word has insufficient memory. If you choose to perform this copy you will not be able to undo what you have done after it"

Or words to that affect... Is anyone aware of another way to supress message boxes when running word macros (the above does not work) ? It is interrupting the auto-creation of a word document and causing word to crash out as a result.

If you could let me know if this is the only way to get around the message boxes I would be grateful as it could be something else I'm working with may be causing the problem aside from Word (and I need to know if it is that).

Thanks in advance.

TonyJollans
09-07-2007, 11:56 AM
Some messages are considered too important to be suppressable.

Can you not find a way to avoid the situation? Perhaps an UndoClear before the copy. Perhaps just buy more memory - it costs peanuts these days :)

murphy84
09-10-2007, 04:01 AM
I found some info on this error on the Microsoft website.

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

It refers to the table of contents and hidden bookmarks as the problem.

Calling the following routine (removing all unnecessary bookmarks) fixes the issue.

Public Sub TidyBookmarks()
Dim bMarks As Bookmarks
Dim bMark As Bookmark

For Each bMark In ActiveDocument.Bookmarks
If InStr(bMark, "tbl") = False Then
bMark.Delete
End If
Next
End Sub

I was quite lucky in figuring it out but at least this seems to work for the time being! :yes

TonyJollans
09-10-2007, 05:44 AM
Yes, you can sometimes get messages about memory which are caused by some other things - not very helpful, but I'm glad you sorted it out.