Automating Master to be Placed in the Active Layer

Started by mikebrick, August 06, 2008, 12:20:30 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

mikebrick

HI,,

When adding a master to a drawing is there any way that the master can automatically be placed only on the active layer and not on their originally associated layer.  I have been looking for a way to create multilayer rack designs with each layer representing a different project.  This can be done manually but it is very tedious. Any thoughts would be greatly appreciated.

Thanks in advanced
Mikebrick

Visio Guy

Hi MB,

I ran the macro recorder to see what Visio thinks about this:


Sub Macro1()

  Dim UndoScopeID1 As Long
  UndoScopeID1 = Application.BeginUndoScope("Layer Properties")

  Dim vsoLayer1 As Visio.Layer
  Set vsoLayer1 = Application.ActiveWindow.Page.Layers.Item(1)
  vsoLayer1.CellsC(visLayerActive).FormulaU = "1"
  Application.EndUndoScope UndoScopeID1, True

  Application.Windows.ItemEx("Drawing1").Activate
  Application.ActiveWindow.Page.Drop Application.Documents.Item("PERIPH_U.VSS").Masters.ItemU("Server"), 2.75, 5.9

End Sub


So you set the active layer by setting the ShapeSheet cell in the page's ShapeSheet that controls "active-ness" for the layer. (Go to Window > Show ShapeSheet with no shapes selected to get an idea of what I'm talking about)

This is a fairly elemental way of getting this done, it's too bad there's no "Layer.Active = True" way of doing this.

Once you've set the active layer, then incoming shapes and master instances will receive the layer automatically.
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010