How to set and save layer properties before closing document

B

Balex

Hi,

I've just added a series of layers to a Visio drawing, and I've added
buttons that toggle the visibility of these layers. What I'm now trying to do
is, just before the document is closed by the user, to set all layers again
to visible. The subroutine that does that is executed properly, but the
resetting seems to be lost: on re-opening, layers that had been made
invisible by the user before closing are still hidden. What am I missing ?
Here my resetting routine, which is called by the
Document_BeforeDocumentClose(ByVal doc As IVDocument) routine:

Sub RestoreLayers(doc As Document)
Dim UndoScopeID1 As Long
UndoScopeID1 = Application.BeginUndoScope("Layer Properties")
Dim selLayer As Visio.layer
Set selLayer = doc.Pages("New overview").Layers.Item("Systems")
selLayer.CellsC(visLayerVisible).FormulaU = "1"
Set selLayer = doc.Pages("New overview").Layers.Item("Interfaces")
selLayer.CellsC(visLayerVisible).FormulaU = "1"
..... more layers reset to visible .....
Application.EndUndoScope UndoScopeID1, True
End Sub

Any help / hints would be GREATLY appreciated

Regards
Balex
 
J

JuneTheSecond

You might need to save drawing before close.
For example;
Private Sub Document_BeforeDocumentClose(ByVal doc As IVDocument)
RestoreLayers doc
doc.Save
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top