Re: Create a connector in a new layer?
- From: "Al Edlund" <edlund@xxxxxxxxxxxxx>
- Date: Fri, 5 Oct 2007 06:02:45 -0500
This is from the visio sdk available on msdn
al
'*********************************************************************
'*********************************************************************
'
' Layer to Page
'
'*********************************************************************
'*********************************************************************
Public Sub AddLayerToPage _
(vsoPage As Visio.Page, _
strName As String, _
Optional strNameU As String, _
Optional blnPrint As Boolean = True, _
Optional blnSnap As Boolean = True, _
Optional blnGlue As Boolean = True, _
Optional blnLock As Boolean = True, _
Optional strColorFormulaU As String)
' AddLayer
'
' Abstract - This procedure adds a layer using the Add
' method on the Layers object. Optionally it sets the
' universal name of the layer. It also sets some of the
' properties of a layer that can be set through the Layer
' Properties dialog in the UI.
'
' Parameters
' vsoPage Page object under consideration
'
' strName Name of the layer (This is the local
' name which appears in the UI.)
'
' strNameU Universal name of the layer.
'
' blnPrint To print or not
'
' blnSnap To snap or not
'
' blnGlue To glue or not
'
' blnLock To lock or not
'
' strColorFormulaU The Color Formula for the layer in
' universal syntax.
'
Dim vsoLayers As Visio.Layers
Dim vsoLayer As Visio.Layer
Dim vsoCell As Visio.Cell
On Error GoTo AddLayer_Err
' Get the Layers collection and add a layer named
' strName.
Set vsoLayers = vsoPage.Layers
Set vsoLayer = vsoLayers.Add(strName)
' If the the optional parameter strNameU is not
' blank, then set the universal name for this layer
' to strNameU.
If (Len(strNameU) > 0) Then
vsoLayer.NameU = strNameU
End If
' Set the value of the layer's Print cell.
Set vsoCell = vsoLayer.CellsC(visLayerPrint)
vsoCell.ResultIU = blnPrint
' Set the value of the layer's Snap cell.
Set vsoCell = vsoLayer.CellsC(visLayerSnap)
vsoCell.ResultIU = blnSnap
' Set the value of the layer's Glue cell.
Set vsoCell = vsoLayer.CellsC(visLayerGlue)
vsoCell.ResultIU = blnGlue
' Set the value of the layer's Lock cell.
Set vsoCell = vsoLayer.CellsC(visLayerLock)
vsoCell.ResultIU = blnLock
' Set the layer's color if the parameter
' strColorFormulaU is not blank.
If (Len(strColorFormulaU)) > 0 Then
' Get the cell and set its universal formula.
Set vsoCell = vsoLayer.CellsC(visLayerColor)
vsoCell.FormulaU = strColorFormulaU
End If
Exit Sub
AddLayer_Err:
MsgBox "AddLayerToPage " & strNameU & " " & Err.Description
End Sub
"Mac" <Mac@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:BDD8811E-37B8-4BB7-B13A-CEF58D7940A7@xxxxxxxxxxxxxxxx
How do I (programatically) create a connector in a new layer? When you create
a connect object it goes to the Connector layer by default ( I suppose). I
want to change this behaviour and make it to appear in a new layer.
I'm thinking of a scenario - create a connector (it goes to the Connector
layer), create a new layer, move the connector form the Connector layer to
this new layer. Is there another way?
Also - what is the correct code for creating new layers? What parameters do
I have to set for it to be accepted by the rest of the system?
.
- Prev by Date: Re: Problems setting up Shape Studio
- Next by Date: Re: Connection-maker macro?
- Previous by thread: Re: Problems setting up Shape Studio
- Next by thread: Re: Move shape with the rest of the group only. Protection?
- Index(es):
Relevant Pages
|