Modify selection of masters in stencil?


    Sponsored Links


  • 1. Code help
    I want to write a macro in Visio 2003 than I can assign to a shape when it is clicked. Here is what I would like the macro to do: Save the current drawing on the current users desktop automatically. I would like the file name to be determined automatically from the value of a custom property within a given shape in the drawing along with the current date. I.E. custname = shape with above custom property of interest. custom property name within shape = "Customer Name" So, file name would be: custname.Customer Name.value current date ( .....or a more specific example: If custname.Customer Name.value = Dow Chemical Current date is 10/05/2006 then the file name would be: Dow Chemical 2006.10.05.VSD After the macro automatically names and saves the file, I would like it to close the Visio program. Thanks for any help. Doug
  • 2. Stencil Obj - Custom Prop get ldap attributes
    Hi All, Firstly Apologies if this is the wrong forum. Am newbie to getting visio to connect to external data sources. Is it possible to have the 'Custom Properties' of a Master query & display the members of an ldap 'group' ? If so how would I go about it! Help & tips welcomed ;-) tia Danny
  • 3. Drag and Drop onto a Visio Canvas
    Hi, I'm working in a C# environment and created an interface containing a listview and a visio canvas. I'd like to drag and drop an item from the listview onto the visio canvas. To do so I have implemented the ItemDrag and the DragOver functions of the listview and I have set the AllowDrop property of the visio control to true Now, my question is which functions I should implement in the visio control in order to accept the drop event? On this moment the cursor changes into a forbidden sign if I hover over the visio control. When dragging and dropping onto another type of control, they contain functions such as DragDrop in which these events can be handled, the visio control however does not seem to contain these functions Can anyone help me with this problem? Greetings Cappy PS: I already tried some of the suggestions in other treads but none of them seem to work for me

Modify selection of masters in stencil?

Postby Gilgil0886 » Wed, 17 May 2006 01:19:43 GMT

I have a C# application hosting a Visio ActiveX control. The
application enables the user to create new masters (programatically).
However, when a new master is created (using Stencil.Drop()), it gets
selected, in addition to the already selected masters.
I know I can get the currently selected masters list from the windows
of the stencil, but is there a way to modify this selection?


RE: Modify selection of masters in stencil?

Postby SnVuZVRoZVNlY29uZA » Wed, 17 May 2006 10:28:01 GMT

This is the same case in VBA and Visual  Basic for Visio proper.
DeselectAll method applied to the stencil window could remove the selection.
In VBA this window could be got by Application.Windows(1).Windows(3).
These number might vary, and ItemFromID property may not be used in other 
language than VBA.


RE: Modify selection of masters in stencil?

Postby SnVuZVRoZVNlY29uZA » Wed, 17 May 2006 12:02:02 GMT

I've made mistake in ItemFromID. ItemFromID can be used in Visual basic also.

Re: Modify selection of masters in stencil?

Postby Gilgil0886 » Wed, 17 May 2006 18:59:45 GMT

Works like a charm. Thanks!

Similar Threads:

1.Visio 2003 - Org Chart from Excel Ignores Modified Masters in Document Stencil

2.Modifying masters in a stencil

Dear All,

I would like to programatically modify a stencil by changing the name and
some properties of the contained master shapes. (The name I want to change
is the name that is displayed below each master in the stencil.)
This is to be implemented in a C# application. However, for testing I wrote
the VBA macro below.

The macro works fine if the stencil is open for editing (mouse click onto
the top left corner of the stencil, then click "Edit").

Question: How can I enter a stencil's edit mode programatically? I tried
this via the AllowEditing flag or by closing and re-opening the stencil with
the 'visOpenRW' flag. Unfortunately, both did not work. I found several
newsgroup threads concerning this issue, but none of them really helped me.

Thanks a lot in advance for any hint!

Best regards,

Public Sub UpdateStencil()
    Dim myStencil As Document
    Dim myMasters As Masters
    Dim myMaster As Master
    Dim myMasterCopy As Master
    Dim myShape As Shape
    Dim index As Integer
    Dim win As Window

    On Error Resume Next

    Set myStencil = Documents("My Stencil.vss")
    myStencil.Title = "New Title"
    Set myMasters = myStencil.Masters
    For index = 1 To myMasters.Count
        Set myMaster = myMasters(index)
        Set myMasterCopy = myMasters(index).Open
        Set myShape = myMasterCopy.Shapes(1)
        myMaster.Name = "New Name"
        myShape.Cells("User.ELEMENT_ID").Formula = 12345
    Next index
End Sub

3.Modify a shape master and update all the shapes on the visio p

4.Modify a shape master and update all the shapes on the visio pages

my problem is the following:
1) I create a new shape master
2) I use it many times in a one or more visio pages
3) then when I make a modification on the shape master I would automatically 
update all the shapes on the visio pages I used before; is that possibile? 
Please, help me!

5.DoDragDrop on modified master shapes has strange side-effect

The scenario is the following:

I have a tree which I drag shapes from. When dragging the item, i find its 
corresponding master in the document stencil (via doc.Masters.get_ItemU) and 
DoDragDrop(foundMaster, DragDropEffects.Copy) on the master shape I get.

After doing this a couple of times (and it works as it should) i edit (in 
visio) the master shape in the document stencil. After updating all 
references i try dragging another one in from my tree. The dragged object 
looks fine, but when releasing/dropping the shape on the drawing surface, the 
text is renamed to what it was before, and another master is created in the 
document stencil.

Why is this happening? My code find the correct master since the text is 
correct when dragging the item without releasing it... But Visio does 
something when i release it. I know that the UniqueID changes when editing 
the text, but should this really be a problem?

If i edit the master in the document stencil before doing any drag-and-drop 
operation, then drag-and-drop works (no change of text and no new master 
shape), but immediately after editing the master, it starts acting weird!

Dragging the master from the document stencil works fine in every case.

Another thing:
I have also noticed that the icon when my drag-and-drop operation is going 
on, is more like in windows explorer, but when using the document stencil 
it's only a small 'plus' sign. What is the difference?.. How can I access 
Visios internal drag-and-drop functionality?

6. Modified Shape Masters have funny effect on Text Placement

7. master shape in stencil versus document stencil

8. How to update document stencil master from stencil

Return to VISIO


Who is online

Users browsing this forum: No registered users and 19 guest