try something like this
al
'
' put the names of a layers into a custom property
' named layerlist
'
Public Sub SaveLayers
Dim visPage As Visio.Page
Dim visShapes As Visio.Shapes
Dim visShape As Visio.Shape
Dim visLayers As Visio.Layers
Dim visLayer As Visio.Layer
Dim visCell As Visio.Cell
Dim intI As Integer
Dim intLayerCt As Integer
Dim strOut As String
Set visPage = Application.ActivePage
Set visShapes = visPage.Shapes
For Each visShape In visShapes
strOut = ""
intLayerCt = visShape.LayerCount
For intI = 1 To intLayerCt
Set visLayer = visShape.Layer(intI)
If intI <> visShape.LayerCount Then
strOut = strOut & visLayer.Name & ", "
Else
strOut = strOut & visLayer.Name
End If
Next intI
If visShape.CellExists("Prop.LayerList", False) Then
Set visCell = visShape.Cells("prop.layerlist")
visCell.Formula = StringToFormulaForString(strOut)
End If
Next
End Sub
'
' this from the visio 2003 sdk
'
Public Function StringToFormulaForString(strIn As String) As String
Dim strResult As String
On Error GoTo StringToFormulaForString_Err
strResult = strIn
' Replace all (") with ("").
strResult = Replace(strResult, Chr(34), _
Chr(34) & Chr(34))
' Add ("") around the whole string.
strResult = Chr(34) & strResult & Chr(34)
StringToFormulaForString = strResult
Exit Function
StringToFormulaForString_Err:
Debug.Print Err.Description
End Function