Is it possible to select the master available in the open stencil.

D

Deepa

i need to highlight a master available in the stencil programatically. its
like searching for the master and highlighting that object.
 
V

VisMan

Hi Deepa,

Got the “SelectAll” in the stencil to work but not the “Select” t
visibly select a specific Master or Shape. I’ll put the code up her
anyway.

Hope this helps somehow,
Rory
Visiolize.com

Constants for the objWindow.Select objShape, visSelect I tried
visDeselect=1,Deselects a shape but leaves the rest of the selection
unchanged.
visSelect=2,Selects a shape but leaves the rest of the selectio
unchanged.
visSubSelect=3,Selects a shape whose parent is already selected.
visSelectAll=4,Selects a shape and all its peers.
visDeselectAll=256,Deselects a shape and all its peers.

Public Function TestSelection()

Dim strStencil As String
Dim objWindow As Visio.Window
Dim objWindows As Visio.Windows
Dim objDocument As Visio.Document
Dim objMaster As Visio.Master
Dim objMasterCopy As Visio.Master
Dim objSelection As Visio.Selection
Dim objShapes As Visio.Shapes
Dim objShape As Visio.Shape
Dim i As Integer
Dim j As Long
Dim lngMastersCount As Long

‘ change this
strStencil = "My Stencil"

Set objWindows = ActiveWindow.Windows
For i = 1 To objWindows.Count

Set objWindow = objWindows(i)
If StrComp(UCase(objWindow.Caption), UCase(strStencil)) =
Then

' this works to visibly select all
objWindow.SelectAll
'-------------------------

Set objDocument = objWindow.Document
lngMastersCount = objDocument.Masters.Count
For j = 1 To lngMastersCount

' tried a few things here
' some Master and Shape references
Set objMaster = objDocument.Masters(j)
Set objMasterCopy = objMaster.Open
Set objShapes = objMasterCopy.Shapes
Set objShape = objShapes(1)


'Set objSelection = objWindow.Selection
' couldn't get this to work
'objWindow.Select objShape, visSelect
' or this
'objSelection.Select objShape, visSelect
objMasterCopy.Close
Next j

Exit For

End If
Next i

End Functio
 

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