Locking Background Layer

Started by jfleischman, July 10, 2020, 03:13:42 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

jfleischman

Hello,

Wondering if I can get some guidance on how to "lock" a layer that I am using as a background. So far my code is as follows, with my best guess on how to lock it in the last line, which did not work.


'Set the Active Page
VisioPage = VisioDoc.Application.Active Page

'Add New Visio Layer
VisioLayers = VisioPage.Layers
Visio:ayer1 = VisioLayers.Add("Background")

'Import BMP file into background
VisioShape = VisioPage.Import(DestinationFilePath)

'Default Drawing Size MUST = "D" 34in X 22in

'Set Background Image Center Position
VisioShape.CellsU("PinX").FormulaU = "17in"
VisioShape.CellsU("PinY").FormulaU = "11in"

'Set the Background Image size same as the page size
VisioShape.CellsU("Width").FormulaU = "34in"
VisioShape.CellsU("Height").FormulaU = "22in"

'Lock the Background Image
VisioShape.CellsU("LockWidth").Formula = "1"
VisioShape.CellsU("LockHeight").Formula = "1"
VisioShape.CellsU("LockMoveX").Formula = "1"
VisioShape.CellsU("LockMoveY").Formula = "1"
VisioShape.CellsU("LockRotate").Formula = "1"
VisioShape.CellsU("LockSelect").Formula = "1"
VisioShape.CellsU("LockDelete").Formula = "1"
VisioShape.CellsU("LockReplace").Formula = "1"

'Assign Background Image to Background Shape
VisioLayer1.Add(VisioShape, 0)

'Lock the Background Layer
VisioLayer1.CellsU("Lock").FormulaU = "1"


Thanks!

Surrogate

You want lock your shape via layers management or/and protect  via Lock<some_proprty>?

jfleischman

I want to lock via layer properties

jfleischman

Figured it out, anyone with the same problem I solved it like this

VisioLayer1.cellsC(7).FormulaU = "1"