Modifying masters in a stencil

From: Markus Breugst (markus.breugst__AT__gedilan-technologies.de)
Date: 01/07/05

  • Next message: Mark: "Visio 2000 "File Not Found" error 1502"
    Date: Fri, 7 Jan 2005 15:06:47 +0100
    
    

    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


  • Next message: Mark: "Visio 2000 "File Not Found" error 1502"

    Relevant Pages

    • Saving Changes to A Master in a Stencil --> Help
      ... I wish to add an Action to a Visio Master in a stencil. ... If I manually place the stencil in 'Edit' then I am able to save the ... Dim mastObjCopy As Visio.Master ...
      (microsoft.public.visio.developer.vba)
    • Re: Problems with Drop() function.
      ... stencil is not ... '// document is not in the collection, opens it as a docked stencil. ... '// then gets the master, using its universal name masterNameU, and ... Dim visioApplication As ...
      (microsoft.public.visio.developer)
    • Re: question about developing with shapesheet
      ...     Dim stnObj As Visio.Document ... the LockWidth of the Line master to 1. ... dropped it from the stencil to the frame. ...
      (microsoft.public.visio.developer)
    • RE: macro
      ... The formula is represented as a string like: ... Dim anyFormula As String ... after the code copies the updated entries over to the Master sheet? ... Dim MasterSheet As String ' for name of the Master sheet ...
      (microsoft.public.excel.misc)
    • RE: macro
      ... The formula is represented as a string like: ... Dim anyFormula As String ... after the code copies the updated entries over to the Master sheet? ... Dim MasterSheet As String ' for name of the Master sheet ...
      (microsoft.public.excel.misc)