How can I make new drawing based on a template file in drawing activx control?

Y

YOUNGHEE

I tried below code, but ...

Private Sub mnuFileNew_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles mnuFileNew.Click
Dim docObj As Document

docObj = adcMain.Window.Application.Documents.Add("seed_a1.vst")
End Sub
 
M

Mai-lan [MS]

Hi, Younghee:
Try the OpenEx method instead. You can use it with a VSS or a VST file. You will get a blank drawing if you open up a stencil or the template, and can specify the behavior of the stencil(s).

From the help file:
Opens an existing Visio file using extra information passed in an argument.

objRet = object.OpenEx (FileName, Flags)
objRet A Document object that represents the file that was opened.

object Required. An expression that returns a Documents collection.

FileName Required String. The name of the file to open.

Flags Required Integer. Flags that indicate how to open the file.



Version added
4.0

Remarks
The OpenEx method is identical to the Open method, except that it provides an extra argument in which the caller can specify how the document opens.

The Flags argument should be a combination of zero or more of the following values.

Constant
Value

visOpenCopy
&H1

visOpenRO
&H2

visOpenDocked
&H4

visOpenDontList
&H8

visOpenMinimized
&H10

visOpenRW
&H20

visOpenHidden
&H40

visOpenMacrosDisabled
&H80

visOpenNoWorkspace
&H100


If visOpenDocked is specified, the file appears in a docked rather than an MDI window, provided that the file is a stencil file and there is an active drawing window in which to put the docked stencil window.

If visOpenDontList is specified, the name of the opened file does not appear in the list of recently opened documents on the File menu.

If visOpenMinimized is specified, the file opens minimized— it is not active. This flag is not supported in versions of Visio earlier than 5.0b.

If visOpenMacrosDisabled is specified, the file opens with Visual Basic macros disabled. This flag is not supported in versions earlier than Visio 2002.

If visOpenHidden is specified, the file opens in a hidden window.

If visOpenNoWorkspace is specified, the file opens with no workspace information.



Example
This Microsoft Visual Basic for Applications (VBA) macro shows how to use the OpenEx method to open a copy of a stencil file in Visio.


Public Sub OpenEx_Example()

'Use the OpenEx method to open a copy of a stencil.
Documents.OpenEx "Basic_U.vss", visOpenDocked + visOpenCopy

End Sub




Thanks,
Mai-lan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top