Visio2000: Sample Macro to Open a New Blank Drawing (289883)



The information in this article 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 ""
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 ("templatename.vst") 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 ("vss").
  • To open a copy of a stencil, pass the stencil name ("stencilname.vss").
  • To open a copy of a drawing, pass the drawings name ("drawingname.vsd").
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.

REFERENCES

For additional information about how to use the sample code in this article, click the article number below to view the article in the Microsoft Knowledge Base:

277011 Visio2000: How to Run Sample Code from Knowledge Base Articles

Or, go to the following Microsoft Web site:

Modification Type:MajorLast Reviewed:6/17/2005
Keywords:kbhowto KB289883