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