How to: Programmatically close Visio documents
Applies to: Visual Studio Visual Studio for Mac
Note
This article applies to Visual Studio 2017. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here
You can close the active Microsoft Office Visio document by using the Microsoft.Office.Interop.Visio.Document.Close
method.
For details about this method, see the VBA reference documentation for the Microsoft.Office.Interop.Visio.Document.Close method.
Close the active document
To close the active document
Call the
Microsoft.Office.Interop.Visio.Document.Close
method to close the active document.To use the following code example, run it in the
ThisAddIn
class in a VSTO Add-in project for Visio.this.Application.ActiveDocument.Close();
Me.Application.ActiveDocument.Close()