VB 6 Embedded Visio Template No Stencil

D

Derl

I'm using a Visio 2002 template that I have embedded as an OLE object in a
VB 6 form. When I turn it into an exe and distribute, the drawing is there
but the stencil is not (Except on my machine). I believe stencils and
toolbars are not visible by default. But how do I turn the stencil on where
it is visible in the distributed exe's. I know MS gives info on the Visio
2003 Activex control that talks about this. But nothing in 2002.

Thanks
 
C

Chris Roth [ Visio MVP ]

First check: are the stencils in fact open?

ie: myVisioApp.Documents.Count > 1 ?? This will count even docked stencils.

If the stencils aren't open, could it be a path problem of some sort?

--

Hope this helps,

Chris Roth
Visio MVP
 
D

Derl

Excellent. Thats the tip I needed. It was a path thing.

But I was hoping that when I embedded the Visio template into the VB 6 app,
it would embed the associated stencil too. It doesn't seem to do that. I
would have to include a stencil file (and the exact path it needed) along
with the exe file to get it all working. Is that correct?

Thanks for the help
 
C

Chris Roth [ Visio MVP ]

Not necessarily. Visio recognizes certain names and opens the corresponding
stencil by looking at its own content. To get a look at these names, do
this:

1. Open the stencil that you care about all by itself.
2. Open a blank document (to get a VBA environment)
3. Hit Alt + F11 to go to VBA
4. Type on the VBA command line:
? ThisDocument.AlternateNames

This will give you the names that you can use to open a stencil that
"should" be loaded on the user's machine. Think of them as "friendly names".

I opened Basic Shapes and got this:
"BASIC_U.VSS;Basic Shapes (US units).vss;BASIC_M.vss;Basic Shapes.vss;<Begin
Localize>;Basic Shapes.vss;BASIC.VSS"

Knowing the above, you can use:

visio.Documents.open("BASIC_U.VSS")
visio.Documents.open("Basic Shapes (US units).vss")

To open the stencil. Be careful about foreign machines, they might only have
the metric versions. But I'm pretty sure that these english names work on
all language of Visio. IE: all users will have either "BASIC_U.VSS" or
"BASIC_M.VSS"

Alternate names gives you some nice double and triple checking capability,
and you still don't need to do any path programming.

Last note: if the stencil and/or templates are your creations, then just put
them wherever your app is installed.

--

Hope this helps,

Chris Roth
Visio MVP
 
D

Derl

Definately a help. Thanks again.

Chris Roth said:
Not necessarily. Visio recognizes certain names and opens the corresponding
stencil by looking at its own content. To get a look at these names, do
this:

1. Open the stencil that you care about all by itself.
2. Open a blank document (to get a VBA environment)
3. Hit Alt + F11 to go to VBA
4. Type on the VBA command line:
? ThisDocument.AlternateNames

This will give you the names that you can use to open a stencil that
"should" be loaded on the user's machine. Think of them as "friendly names".

I opened Basic Shapes and got this:
"BASIC_U.VSS;Basic Shapes (US units).vss;BASIC_M.vss;Basic Shapes.vss;<Begin
Localize>;Basic Shapes.vss;BASIC.VSS"

Knowing the above, you can use:

visio.Documents.open("BASIC_U.VSS")
visio.Documents.open("Basic Shapes (US units).vss")

To open the stencil. Be careful about foreign machines, they might only have
the metric versions. But I'm pretty sure that these english names work on
all language of Visio. IE: all users will have either "BASIC_U.VSS" or
"BASIC_M.VSS"

Alternate names gives you some nice double and triple checking capability,
and you still don't need to do any path programming.

Last note: if the stencil and/or templates are your creations, then just put
them wherever your app is installed.

--

Hope this helps,

Chris Roth
Visio MVP


object
 

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