View Single Post
 
Old 11-09-2019, 02:28 AM
Guessed's Avatar
Guessed Guessed is offline Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,974
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

OK, perhaps you might want to show me the code you are using. It shouldn't be difficult to change shape masters. For instance, in this code extract the choice of shape master is on one line.
Code:
  With appVisio
    If .Documents.Count > 0 And Not bNewDoc Then
      Set aDoc = .ActiveDocument
      Set aPage = aDoc.Pages.Add
    Else
      Set aDoc = .Documents.Add(Filename:=sTemplatePath & sVisioTemplate)
      Set aPage = .ActivePage
    End If
    Set aDocStencil = GetDocStencil(appVisio, sStencil, sStencilPath)      'Load Stencil
    
    'Clear page for new shapes to be added
    Do While aPage.Shapes.Count > 0
      aPage.Shapes(1).Delete
    Loop
    aPage.AutoSize = False
    Set aMast = aDocStencil.Masters(sMaster)
    On Error Resume Next
    For Each aRow In loWBS.DataBodyRange.SpecialCells(xlCellTypeVisible).Rows
      Debug.Print Trim(aRow.Cells(1).Value)
      lRow = lRow + 1
      lLeftStep = aRow.Cells(3).Value
      If lRow > 1 Then sParent = Trim(aRow.Cells(4).Value)
      If bJoin And sParent <> "" Then
        Set aShp = aPage.DropConnected(aMast, aPage.Shapes("WBS_" & sParent), 2)    'visAutoConnectDirDown=2
      Else
        lPosY = lPosY - lPrevShapeHeight - dblSpacing
        Set aShp = aPage.Drop(aMast, 1 + lLeftStep / 2, lPosY)    ' 10 - lRow / 3
        lPrevShapeHeight = aShp.CellsU("Height")
      End If
      aShp.Name = "WBS_" & Trim(aRow.Cells(1).Value)
      For i = LBound(arrProps) To UBound(arrProps)
        sProp = "Prop." & arrProps(i)
        aShp.CellsU(sProp).FormulaU = Chr(34) & Trim(aRow.Cells(i + 1).Value) & Chr(34)
      Next
    Next aRow
This code extract is more complicated than necessary because it includes an option to link child graphics or place them in an indented tree structure without a link depending on a choice the user made earlier.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote