How "Auto" Macros Work with OLE Objects

ID: Q126662


The information in this article applies to:
  • Microsoft Word for Windows, versions 6.0, 6.0a, 6.0c
  • Microsoft Excel for Windows, version 5.0
  • Microsoft PowerPoint for Windows, versions 4.0, 4.0a, 4.0c
  • Microsoft Exchange Client for Windows 95


SUMMARY

When you embed a Word document that contains an autoexecuting macro (such as AutoExec or AutoClose) in an OLE client application (such Microsoft Excel), the macro may behave differently than expected.

For example, if you embed a Word document whose template contains an AutoExec macro, the macro starts a new session of Word each time you activate the Word object. This may not be obvious, as the new session of Word is behind the OLE client (Microsoft Excel, for example), and the OLE client remains the active program. However, because a new session is started, you may eventually receive "Out of Memory" messages.

In addition, you may receive a General Protection Fault message such as:

Winword Caused a General Protection Fault in Module WINWORD.EXE at 0011:6c31.
This article contains a table that describes the behavior of Word autoexecuting macros when embedded in OLE client applications.


STATUS

Microsoft has confirmed this to be a problem in Microsoft Word for Windows, versions 6.0, 6.0a, and 6.0c. This problem was corrected in Microsoft Word for Windows 95, version 7.0.


MORE INFORMATION

Word version 7.0 will not run any autoexecuting macros when a Word document is embedded in another program. Microsoft Binder may hang or possibly produce a GP Fault if a Word Document contains an AutoClose macro that contains user intervention.

In the following table, "Menu Option" refers to the choice you make in the client application to edit the object.


Menu
Option  Macro Name  Behavior
------  ----------  --------

Edit    AutoExec    The macro runs and you are returned to "in-place
                    editing" in your server, but a separate Word
                    application window has been opened that you must close
                    manually.

Edit    AutoOpen    The macro does not run.

Edit    AutoClose   The macro does not run unless the document template
                    also contains an AutoExec macro. The AutoExec macro ran
                    when you activated the Word object. After you
                    deactivate the Word object, and switch to Word, the
                    AutoClose macro will now run.

Edit    AutoExit    (Same behavior as the AutoClose macro.)

Open    AutoExec    The macro runs.

Open    AutoOpen    The macro does not run.

Open    AutoClose   The macro runs.

Open    AutoExit    The macro runs. 

Additional query words: 6.0 5.0 winword word6 object linking and embedding OLE kbole auto automacro happens in-place editing

Keywords : kbinterop
Version : WINDOWS:4.0,4.0a,4.0c,5.0,6.0,6.0a,6.0c; Win95:
Platform : Win95 WINDOWS
Issue type :


Last Reviewed: December 20, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.