Author Topic: Print a layer based on file properties  (Read 3787 times)

0 Members and 1 Guest are viewing this topic.

BenG

  • Newbie
  • *
  • Posts: 2
Print a layer based on file properties
« on: June 02, 2008, 10:15:21 AM »
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

Visio Guy

  • Administrator
  • Hero Member
  • *****
  • Posts: 1716
  • Smart Graphics for Visual People...n' Stuff
    • Visio Guy
Re: Print a layer based on file properties
« Reply #1 on: June 02, 2008, 11:06:22 AM »
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" ) )

For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

BenG

  • Newbie
  • *
  • Posts: 2
Re: Print a layer based on file properties
« Reply #2 on: June 02, 2008, 11:15:32 AM »
Perfect!  Thanks for the help.

BTW: Great Forum!