Visio Guy

Visio Discussions => ShapeSheet & Smart Shapes => Topic started by: BenG on June 02, 2008, 03:15:21 PM

Title: Print a layer based on file properties
Post by: BenG on June 02, 2008, 03:15:21 PM
Hello -

I have a custom watermark on a layer of my "background" page.  The text of the watermark is pulled from the "description" field of the file properties. 

This watermark needs to print in all cases unless the description field = "MFG Release"

I tried adding the following logic to the shapesheet for the background page for the relevant layer:

Print:  IF(DESCRIPTION()="MFG RELEASE",FALSE,TRUE)

This logic seems to work the first time it is entered but will not re-evaluate when the description field changes. 

Any ideas? Would it be better to handle this in VB code rather than the ShapeSheet?

Regards
Title: Re: Print a layer based on file properties
Post by: Visio Guy on June 02, 2008, 04:06:22 PM
Hi BenG,

I assume you're already in the ShapeSheet... Anyway, text comparison is a bit tricky. You need to use the STRSAME function to get it done, otherwise Visio will try to evaluate the text as a formula or a number. For generic strings, that value is effectively 0, which tricks people into thinking that their comparison is working half the time.

So try this, where your layer in question is in the second row of the Page ShapeSheet's Layers section:

Layers.Print[2] = IF( STRSAME( DESCRIPTION(), "MFG RELEASE" ), FALSE, TRUE )

or just

Layers.Print[2] = NOT( STRSAME( DESCRIPTION(), "MFG RELEASE" ) )

Title: Re: Print a layer based on file properties
Post by: BenG on June 02, 2008, 04:15:32 PM
Perfect!  Thanks for the help.

BTW: Great Forum!