Visio automation

F

Florian Albrecht

Hello!

I am creating some organigrams via visio with OLE automation. Now there
is a modal dialog which shows how to connect shapes. How can I surpress
this modal dialog via OLE? I tried
mpApplication->SetAlertResponse(IDOK), but this has no effect. What goes
wrong here?

thanks in advance
Florian Albrecht
 
M

Mark Nelson [MS]

In this case the dialog probably does not honor the AlertResponse setting.
This particular dialog only appears once per user and then will not be shown
again.
 
F

Florian Albrecht

Well, I think the dialog will appear once pers user and session. If the
user does not set the don't-show-meassage-again flag, the dialog comes
up on every start of visio.

Is there an easy way to set this flag?

Florian Albrecht
 
M

Mike Mueller [MSFT]

This dialog is controlled by a registry setting. The key is:
"HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Visio\Solution\Organization
Chart"

The Value is:
"ShowHowToConnect"

Set the value to "0" (zero) and the dialog will not appear.
 
F

Florian Albrecht

Hey Mike!

Thanks, that's what I was looking for. But as I can see it will work
only for Version 11 (Visio 2003). What about older versions of Visio?
Are there similar flags? For Visio 2002 for example I can't find the
Value "ShowHowToConnect".

Florian Albrecht
 
M

Mike Mueller [MSFT]

Visio 2002 worked the same way but the registry setting was under a
different key. I don't have an installation of Visio 2002 available but if
you use regedit and brows the HKCU/Software/Microsoft/Visio subtree you can
probably find it.
 
M

Mark Nelson [MS]

Documentation? We don't want to put Graham Wideman out of business! :)

--
Mark Nelson
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.
 
J

John Marshall, MVP

True.

John... Visio MVP

Mark Nelson said:
Documentation? We don't want to put Graham Wideman out of business! :)

--
Mark Nelson
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no
rights.
 
L

Lant

Unable to post a new thread due to some weird reason related to blocking
pop-ups. Anyway the following is a new problem. I am trying to display
stencils based on the user selection (made thru VBA GUI). How can I create a
shape for every record in the resulting query at runtime. Thank you.

Lant
 
J

John Marshall, MVP

The following code will open a specific stencil and drop a given shape. If
you are able to read from your database, then you can modify the text
strings "Blocks Raised.vss" and "Circle" to
drop the appropriate shape from the appropriate stencil. You can also pass
the desired location and replace the "1,3" in the Drop statement.


Dim stencil As Visio.Document, mstCircle As Visio.Master
Set stencil = ThisDocument.Application.Documents.Open("Blocks Raised.vss")
ThisDocument.Application.Windows(ThisDocument.Index).Activate
Set the ActiveWindow to the drawing window.
Set mstCircle = stencil.Masters("Circle") ' Get the master named "Circle"
and drop that shape on the page!
ThisDocument.Pages(1).Drop mstCircle, 1, 3 ' Drop the shape, mstCircle, at
location X=1 Y=3


--
John... Visio MVP

Need stencils or ideas? http://www.mvps.org/visio/3rdparty.htm
Need VBA examples? http://www.mvps.org/visio/VBA.htm
Common Visio Questions http://www.mvps.org/visio/common_questions.htm
 
L

Lant

Thanks John - I missed a detail in my question. I meant I would like to
create a Stencil which contains only the selected masters so that the user
can pick shapes from the limited stencil to create the diagram. To do this
can I follow the steps you mentioned and save the drawing created as a
Stencil (though not sure how) or is there a more straight forward way to
either (1) create masters on a stencil from the database at runtime and
selectively make them visible at runtime OR
(2) Populate the stencil with masters based on a query. -The 2nd option can
be done from the menu options thru Database Wizard but I was not able to
capture the macro to figure out how to do it programmatically.

Scenario In detail - The user selects a pack. A pack consists of several
items - this info is stored in the database. Based on the user selection of
the pack, the stencil should contain only the masters for the items that are
contained in the pack.

Thank You
Lant P
 
J

John Marshall, MVP

Are you looking for a two step process?
1) Create the specialized stencils
2) Let the user select from the specialized stencils.

A little Visio background: The internal format of a Visio file is identical,
no matter what the file extension is. The file extension only lets Visio
know how to open the file. When you drag shapes to a Visio drawing, a copy
of the shape is stored in an internal stencil within the drawing. So if you
create a drawing that contains shapes you would like to make a stencil of,
the easiest way is to rename the file from xyz.vsd to xyz.vss. There of
course some file blot because of the existence of the drawing.

Another way to create a new stencil is to open the original stencils and
then create a new stencil by using the Save As from the file menu.

John... Visio MVP

Need stencils or ideas? http://www.mvps.org/visio/3rdparty.htm
Need VBA examples? http://www.mvps.org/visio/VBA.htm
Common Visio Questions http://www.mvps.org/visio/common_questions.htm
 
L

Lant

Thanks John - That should prove very useful. I just started working on Visio
couple of weeks back and had no clue about the file formats. And yes you got
me right - I'm attempting a two step process.
 
M

Mike Mueller [MSFT]

I have moved to a different group so I am not sure what the plans for
further documentation are. Mai-lan might know.
 
F

florian.albrecht

Not all settings are set in the Registry. To save space items using default
settings will not be written to the registry. There is a flag on the
Advanced tab of the Option dialog to Save all settings to the registry.

Unfortunately I can't set this flag. Is there a way to force Visio to
use the entry in the registry if it exists?

An other way may be to set the "ShowHowToConnect"-option via OLE. Is
there an interface to set or unset this option?

Florian Albrecht
 
M

Mike Mueller [MSFT]

If the registry key is not there you will have to add it using the Win32
registry APIs.
 

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