Layer > Visible in Visio 2002

B

ben h

I have a procedure in VBA that sets the following:
vsoLayer.CellsC(visLayerVisible).FormulaU = 0
to hide the layer, but in V2002 it doesn't hide the layer, seemingly
just because it doesn't refresh perhaps. Is there something else I
should be doing? A different way of solving this? It works fine in V2003.

If (in V2002 after the macro is run) I then go and perform some trivial
task on a shape on that layer in the drawing page (and then Undo it),
the Shape/Layer hides itself.

Any help appreciated
Ben
 
J

JuneTheSecond

If you use Formula or Formula property, the value must be given in string, "0".
vsoLayer.CellsC(visLayerVisible).FormulaU = 0
If you wish to give value as numeric 0, then it might be
vsoLayer.CellsC(visLayerVisible) = 0
 
B

ben h

OK, I think that's the right idea, but I've tried using the Visio 2003
SDK function "SetCellValueToString" like so:

With vsoLayer
SetCellValueToString .CellsC(visLayerVisible), "0"
SetCellValueToString .CellsC(visLayerPrint), "0"
End With

and that's not working. I've also tried your second idea there:
vsoLayer.CellsC(visLayerVisible) = 0
But that doesn't do it either.

Here's some more info, the Layers in question are on a Background page.
If I run the macro whilst the background page is the Active page, then
it works (i.e. shows/hides the layers), but if the active page is a
foreground page, it doesn't work!!

The shapes are only members of one layer by the way.

I've stepped through the code a stupid number of times now, I must be
missing something really obvious.

I have ScreenUpdating set to False during the macro, have tried turning
this off to no avail.

Is there a way i can check the ShapeSheet of a Layer directly? Is there
some way I can try to find out what the cell value/formula really is?

Any more help appreciated.
 
A

Al Edlund

Every page will have it's own layer sets, so your code will have to control
what page is active.
al
 
B

ben h

I would have thought that if I get an object reference to a page, then a
reference to a layer on that page object I wouldn't have to do anything
relating to the user view (i.e. Active Page)? This is what I have done,
though I didn't say so before.
 

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