Microsoft KB Archive/289883

= Visio2000: Sample Macro to Open a New Blank Drawing =

Article ID: 289883

Article Last Modified on 1/31/2007

-

APPLIES TO


 * Microsoft Visio 2000 Standard Edition
 * Microsoft Visio 2000 Professional Edition
 * Microsoft Visio 2000 Technical Edition
 * Microsoft Visio 2000 Enterprise Edition

-



This article was previously published under Q289883



SUMMARY
This article contains a sample Microsoft Visual Basic for Applications macro (Sub procedure) to open a new blank drawing.



MORE INFORMATION
Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.

Sample Code
To add a new blank drawing, pass an empty String variable to the Documents.Add method: Public Sub OpenNewBlankDrawing Visio.Application.Documents.Add &quot;&quot; End Sub Additional arguments for the Document.Add method allow you to do the following:
 * To create a new drawing based on a template, pass the template name (&quot;templatename.vst&quot;) to the Add method. Visio opens stencils that are part of the template's workspace and copies styles and other settings associated with the template to the new document. If the template file name is invalid, no document is returned, and Visio generates an error.
 * To create a new stencil based on no stencil, pass (&quot;vss&quot;).
 * To open a copy of a stencil, pass the stencil name (&quot;stencilname.vss&quot;).
 * To open a copy of a drawing, pass the drawings name (&quot;drawingname.vsd&quot;).

NOTE: Opening a copy of a stencil or drawing is equivalent to selecting Copy in the Open dialog box (under Open), or to using the OpenEx method with the visOpenCopy flag.

