Modifying masters in a stencil
From: Markus Breugst (markus.breugst__AT__gedilan-technologies.de)
Date: Fri, 7 Jan 2005 15:06:47 +0100
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!
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