fertski.blogg.se

Page layers in microsoft publisher
Page layers in microsoft publisher




  1. #Page layers in microsoft publisher code
  2. #Page layers in microsoft publisher free

Notice how I only call the mandatory settings when the document is opened and not when the User Form is opened by your user.

page layers in microsoft publisher

I’ve only defined two layers for the sample file, so only have those lines included in the file.

#Page layers in microsoft publisher code

Private Sub Document_DocumentOpened(ByVal Doc As IVDocument)Īs you might have noticed, you will need to define each layer property (Visible and Print) individually with my code, but this only has to be done once and you can quickly copy and paste the existing code for new layers you are introducing to the drawing. Private Sub btnLayerSelection_Click()į = checkLayerSetting("Layer01", conVisible)į = checkLayerSetting("Layer01", conPrint)į = checkLayerSetting("Layer02", conVisible)į = checkLayerSetting("Layer02", conPrint) I have used the default Private Subs VBA offers and added the code to each Sub to call upon the previously created functions. So now all that is left for this part is making sure the created functions are called when I click on the Command Button or open the drawing. I personally wanted to make sure the Info layer I created in my drawing (explaining the function of the command button) would always be visible when opening the drawing, but never be printed. VsoLayer1.CellsC(visLayerPrint).FormulaU = "0" VsoLayer1.CellsC(visLayerVisible).FormulaU = "1" The second function I’ve added to this code is a function to set some mandatory configuration settings in case you want some Visio layers to always be visible or never to be printable.

#Page layers in microsoft publisher free

MsgBox "Layer setting error: Unknown Type"Īpplication.EndUndoScope UndoScopeID1, TrueĪgain I’ve only implemented the properties Visible and Print for a layer, so feel free to add more options when needed. Set vsoLayer1 = .Item(strLayerName)ĬheckLayerSetting = vsoLayer1.CellsC(visLayerVisible).FormulaUĬheckLayerSetting = vsoLayer1.CellsC(visLayerPrint).FormulaU UndoScopeID1 = Application.BeginUndoScope("Layer Properties") Function checkLayerSetting(strLayerName As String, intType As Integer) I’ve created a function to check the current configuration of each layer’s property (only Visible and Print implemented), so I’ll know whether a select box on my form needs to be selected or not. If you want users to also set other properties, feel free to add more constants to the code.

page layers in microsoft publisher

The code starts with the declaration of two constants that represent the selection of a layer property to address (I’m only using Visible and Print, not the other properties like Active, Snap and Glue). I’ll walk you through each step of the code and explain the parts you can easily adjust for your own drawing and layers. To keep the code to a minimum, I’ve created some reusable functions and declared some constants.

page layers in microsoft publisher

The second part is the code for the User Form we created and will be explained lateron. This code defines the actions that are perform when the drawing is opened and when user clicks on the command button. The used code is divided over two parts, first there’s the code for ThisDocument, which contains all the code for the document and command button. Visio Layers Document Code Explaining the code






Page layers in microsoft publisher