Microsoft KB Archive/254917

From BetaArchive Wiki
Knowledge Base

Visio5: Visio Terminates Unexpectedly When You Use Automation to Close a Document Object

PSS ID Number: 254917

Article Last Modified on 11/25/2003

The information in this article applies to:

  • Microsoft Visio Standard 5.0x
  • Microsoft Visio Professional 5.0x
  • Microsoft Visio Technical 5.0x
  • Microsoft Visio Enterprise 5.0x
  • Microsoft Visual Basic for Applications

This article was previously published under Q254917


If you use Automation to close a document in Visio, Visio may terminate unexpectedly, and you may receive the following error message:

Run-time error '-2147023898 (800703e6)':
Automation error
Invalid access to memory location.


Visio may shut down unexpectedly when the Automation client calls the Document.Close method of Visio while running outside of Visio's process, and the document is part of a VBA project.


To prevent this behavior, do one of the following:

  1. If the Automation client is a Visual Basic application, add an OnError handler to the Document.Close statement in your code.
  2. Disable Visual Basic for Applications in Visio. To do so, click Options on the Tools menu, and then click to clear the Enable Microsoft Visual Basic for Applications check box on the Advanced tab.

Keywords: kbdtacode KB254917
Technology: kbVBASearch kbVisio500xSearch kbVisioSearch kbZNotKeyword3 kbZNotKeyword6