Modifying masters in a stencil

M

Markus Breugst

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,
Markus


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
myMasterCopy.Close
Next index
myStencil.Save
End Sub
 

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