Word - receiving Run Time Error 7 - Out of memory

P

Phil Melek[MSFT]

Here's what I was able to find:


- Microsoft Word 2000
-------------------------------------------------------------------------------

SYMPTOMS
========
When you launch a word document from the windows explorer, a VBA run-time error 5 is returned if the following is true:

You have a Word template in your Startup directory that contains an AutoExec macro that sets an object to a custom
toolbar.

This error does not occur with Word 97 or Word 2002.


WORKAROUND
==========
To workaround this problem, create a template that adds the template with the command bar code as an add-in. Have this
new template in the startup directory instead of the template with the commandbar code. When Word launches from the
double-click of the word document, the macro makes the template with the command bar code an add-in. When this
happens, the autoexec macro in the add-in runs and the run-time error does not occur.

MORE INFORMATION
================

Steps to Reproduce the Behavior
-------------------------------

1. Create a Word 2000 template.

2. Add a custom tool bar. (call it something like mytest)

3. In the template, create a macro called Autoexec with the following lines of code:




Sub Autoexec()

Dim mytoolbar as CommandBar

msgbox "Autoexec"

Set mytoolbar= CommandBars("mytest")

End sub



4. Save this template in the Startup directory for Word.

5. Close out of Word.

6. Launch Word.

7. The macro runs and the blank document comes up.

8. Close back out of Word.

9. Double-click a word document from the desktop or windows explorer.

Actual Results:
----------------

Word launches and the macro runs. When it gets to the line setting the object, a VBA error "Run-time Error 5" is returned.
This does not happen with the same scenario in either Word 97 or Word 2002.


===============

Workaround is to change the template in the startup to load the template with
the command bar code as an add-in.
 
B

Beth Melton

Hi Chris,

A "runtime" error means that there is an error in a macro or add-in
that is attempting to run. Typically these macros are created by a
third-party and are not part of the Word installation. (They could
also be caused by a malfunctioning macro virus as well)

Many third-party applications will create an add-in and place it in
the Office\Startup folder or use a COM add-in (DLL) to integrate their
software with Word.

Go to Tools/Templates and Add-Ins and see if there are any global
templates or add-ins listed. If you find any then chances are they are
located in your Office\Startup folder or Word\Startup folder.

The location of the Word\Startup folder can be found under
Tools/Options/File Locations and the Office\Startup folder will be
located in the installation path for Office.

If you find more than one add-in move them one at a time until you
determine which one is causing the problem.

As of Word 2000, Word can have COM add-ins, those that are added in
via the Registry rather than the Startup folders. To check for COM
add-ins add the "COM Add-In" command to your toolbar.

- Right-click any toolbar and select Customize
- On the Commands tab, select the Tools category
- Locate COM Add-Ins on the right
- Drag/Drop to a location of your choice

For more information on COM Add-Ins, see this article:
http://www.mvps.org/word/FAQs/Customization/CheckIfAddinsInstalled.htm

For additional troubleshooting steps for errors starting/exiting Word
see this article:
http://www.mvps.org/word/FAQs/AppErrors/ProbsOpeningWord.htm


--
Please post all follow-up questions to the newsgroup. Requests for
assistance by email can not be acknowledged.

~~~~~~~~~~~~~~~
Beth Melton
Microsoft Office MVP

Word FAQ: http://mvps.org/word
TechTrax eZine: http://mousetrax.com/techtrax/
MVP FAQ site: http://mvps.org/
 

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