Not enough memory to update the display

E

Eric Simard

Hi everybody,
I need help about a big problem we have. I use VBA of
Access 97 to assemble a very big document in Word 97.
Access take control of Word to insert files, do some
replacements, execute macro, ...
The document I try to assemble is about 650 pages (around
2.5 Megs)
When it executed one of the macro, Word display (several
times) the following message:

Microsoft Visual Basic
Run-time error '1017':
There is not enough memory or disk space to update the
display.
[Continue] [End] [Debug] [Help]

I tried the following actions:
- De-activate the spell-checker.
- De-activate the background save.
- De-activate screen updating before the macro.
- activate the display of pictures as placeholders.
- Save the document at many places in the code.
- Close and re-open Word during execution.

Note: I'm using Word 97 SR-2 on Windows 2000 Professional
(also Nt4.0). I have 256 MB of RAM and 27 GB of disk free
space.

Note: For a temporary use, I splitted the file in 2
documents. Our code works correctly with these documents
but we still have some problems when merging them.

Thanks for all your help.
 
J

Jezebel

A few more things you can try:

1. Clear the Undo list at frequent intervals (Document.UndoClear)

2. Run Word invisibly (wrdApplication.visible = False)

3. If your code uses Word's Selection object, rewrite it to use Range
objects instead.

4. Avoid using Word macros. Since you're running code anyway, do all the
work at the Access end.

5. Load Word with no templates or add-ins (check the command-line switches).
 
W

Word Heretic

G'day "Eric Simard" <[email protected]>,

Jez has some good suggestions, esp #1.

#2 I highly recc AGAINST doing. The small increase in speed is offset
against large decreases in usability and stability.

#3: Always my advice, I have a Word VBA Beginners Spellbook dedicated
to this and many other related issues.

#4: Load of naive rubbish.

#5: See #4. Matter of fact, loading a nicely tuned template to aid the
process actually speeds the process - its ALWAYS ALWAYS ALWAYS faster
to execute native than remote. co-operate and the the lag (or lack of)
will amaze you.

<Waves at Jez and says 'Hi from my mate Mal' - personal tutoring is
very affordable from me>



Jez (the VB guru, not Word VBA guru) suggested:

1. Clear the Undo list at frequent intervals (Document.UndoClear)

2. Run Word invisibly (wrdApplication.visible = False)

3. If your code uses Word's Selection object, rewrite it to use Range
objects instead.

4. Avoid using Word macros. Since you're running code anyway, do all
the
work at the Access end.

5. Load Word with no templates or add-ins (check the command-line
switches).

Eric Simard said:
Hi everybody,
I need help about a big problem we have. I use VBA of
Access 97 to assemble a very big document in Word 97.
Access take control of Word to insert files, do some
replacements, execute macro, ...
The document I try to assemble is about 650 pages (around
2.5 Megs)
When it executed one of the macro, Word display (several
times) the following message:

Microsoft Visual Basic
Run-time error '1017':
There is not enough memory or disk space to update the
display.
[Continue] [End] [Debug] [Help]

I tried the following actions:
- De-activate the spell-checker.
- De-activate the background save.
- De-activate screen updating before the macro.
- activate the display of pictures as placeholders.
- Save the document at many places in the code.
- Close and re-open Word during execution.

Note: I'm using Word 97 SR-2 on Windows 2000 Professional
(also Nt4.0). I have 256 MB of RAM and 27 GB of disk free
space.

Note: For a temporary use, I splitted the file in 2
documents. Our code works correctly with these documents
but we still have some problems when merging them.

Thanks for all your help.

Steve Hudson

Word Heretic, Sydney, Australia
Tricky stuff with Word or words for you.
Email (e-mail address removed)
Products http://www.geocities.com/word_heretic/products.html

Replies offlist may require payment.
 
M

Malcolm Smith

Hi

What I do when I am creating massive documents from an external
application is that every now and again (usually after each page or
section) is to run this code.

The title may give away the purpose of the routine:


Private Sub PreventWordDeath(objWord As Word.Application, _
objDoc As Word.Document)

On Error Resume Next


objDoc.UndoClear
objDoc.Repaginate


objWord.Options.Pagination = False
With objWord.Application
.ScreenUpdating = True
.ScreenRefresh
.ScreenUpdating = False
End With

End Sub


The reason for this routine is that Word tends to blow up after a while if
one is writing massive amounts of data to it from elsewhere. Sure, it
slows down processing but it always gets the job done.


I tend to call this after each page of heavy text which is in a massive
table.

Hope that this helps
Cheers
Malc
www.dragondrop.com
 
W

Word Heretic

G'day (e-mail address removed) (Malcolm Smith),

<ROFLMAO>

I love your function names :)

My "OMG wotta long macro" function is

Public Sub WordGarbageCollection()
'Just use UndoClear unless absolutely necessary
Dim ViewType_pholder As Long
Dim Pagination_pholder As Boolean

DoEvents
'switch to normal view

With ActiveWindow
If .View.SplitSpecial <> wdPaneNone Then .Panes(2).Close
ViewType_pholder = .ActivePane.View.Type
.ActivePane.View.Type = wdNormalView
End With

Pagination_pholder = Options.Pagination
Options.Pagination = True

With ActiveDocument
.UndoClear
.Repaginate
End With

With Application
.ScreenUpdating = True
.ScreenRefresh
DoEvents
.ScreenUpdating = False
End With
ActiveWindow.ActivePane.View.Type = ViewType_pholder
Application.Options.Pagination = Pagination_pholder
DoEvents
End Sub



(e-mail address removed) (Malcolm Smith) was spinning this yarn:
Hi

What I do when I am creating massive documents from an external
application is that every now and again (usually after each page or
section) is to run this code.

The title may give away the purpose of the routine:


Private Sub PreventWordDeath(objWord As Word.Application, _
objDoc As Word.Document)

On Error Resume Next


objDoc.UndoClear
objDoc.Repaginate


objWord.Options.Pagination = False
With objWord.Application
.ScreenUpdating = True
.ScreenRefresh
.ScreenUpdating = False
End With

End Sub


The reason for this routine is that Word tends to blow up after a while if
one is writing massive amounts of data to it from elsewhere. Sure, it
slows down processing but it always gets the job done.


I tend to call this after each page of heavy text which is in a massive
table.

Hope that this helps
Cheers
Malc
www.dragondrop.com

Steve Hudson

Word Heretic, Sydney, Australia
Tricky stuff with Word or words for you.
Email (e-mail address removed)
Products http://www.geocities.com/word_heretic/products.html

Replies offlist may require payment.
 
M

Malcolm Smith

:)

Well it's called that for the simple reason that's what it does. Without
that procedure (and yes some of the code was yours found years ago on the
Word mailing list) then Word spectacularly explodes.

The procedure just does what it says on the tin!

Cheers
Malc
www.dragondrop.com
 
W

Word Heretic

G'day (e-mail address removed) (Malcolm Smith),

<Filed for future reference in a highly expensive copyright case to
obtain a case of beer as royalty>

:)

Still love the name!

(e-mail address removed) (Malcolm Smith) was spinning this yarn:
:)

Well it's called that for the simple reason that's what it does. Without
that procedure (and yes some of the code was yours found years ago on the
Word mailing list) then Word spectacularly explodes.

The procedure just does what it says on the tin!

Cheers
Malc
www.dragondrop.com

Steve Hudson

Word Heretic, Sydney, Australia
Tricky stuff with Word or words for you.
Email (e-mail address removed)
Products http://www.geocities.com/word_heretic/products.html

Replies offlist may require payment.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top