The Hidden Master Cells – ShapeKeywords and Copyright

Readers of my blog will know that I often customize Visio masters, but I rarely bother to (re-)set the keywords or copyright. The reason being that I do not like to change the copyright if it has been set by another, and I was not quite sure where the keywords were stored. So, I decided to document them both here for my (and your) future use!

 

Master Keywords

The Keywords textbox on the Master Properties dialog provides you with the opportunity to enter keywords for the master which can be used by the Search function:

image

However, if you look at the properties of the Master object, you will not find a Keywords property:

image

This is because these keywords are not stored against the master object, but are actually stored in a cell, called ShapeKeywords, in the page of the Master!

Try it for yourself by typing something like the following in the Immediate Window:

?Visio.ActiveDocument.Masters(1).Name
Process
?Visio.ActiveDocument.Masters(1).PageSheet.Cells("ShapeKeywords").ResultStr("")
Process,function,procedure,action,task,basic,flowchart,flow,data,business,six,6,sigma,iSO,9000

 

Surprising, huh?

This cell does not appear in the ShapeSheet window…

Shape Copyright

I was always taught that the Copyright is a write once operation, and indeed that is true if you try to automate it. If you look at the the master shape of a Microsoft supplied master, then you will find the Copyright is read-only:

image

If you draw your own shapes, then the copyright cell is available to edit … until you save it!

image

It is indeed a write once cell, because the next time you open the Shape Name dialog, the Copyright textbox will be greyed out.

In the VBA Immediate Window, you get read the copyright like this:

?Visio.ActiveWindow.Selection.PrimaryItem.Cells("Copyright").ResultStr("")
Here is my own copyright message!

But, if you then tried to overwrite it, you will get an error message:

Visio.ActiveWindow.Selection.PrimaryItem.Cells("Copyright").Formula = "=""Oops, I meant to write this!"""

image

Not surprisingly, this cell does not appear in the ShapeSheet window either…

 

Hiding Information in your Pages

So, knowing that the ShapeKeywords cell is in the PageSheet of a Master, then it follows that it exists in every page. It is perhaps more surprising that the Copyright cell also exists in every page.

Therefore we have two hidden cells that you can address in the ShapeSheet, as in this example Shape Data section:

=GUARD(ThePage!ShapeKeywords)

=GUARD(ThePage!Copyright)

image

You could set the ShapeKeywords cell value in code:

Visio.ActivePage.PageSheet.Cells("ShapeKeywords").Formula = "=""Be smart, be clear, BE VISUAL"""

Visio.ActivePage.PageSheet.Cells("Copyright").Formula = "=""bVisual ltd"""

Then, any shape can read the values:

 

image

It can get a bit tedious to do that an every page, so you could put a SETF() formula into the EventDrop cell of a shape:

=SETF(GetRef(ThePage!Copyright),"=""bVisual ltd""")

image

There is no error if the Copyright cell is written to again … it just fails. Therefore the first set of the page Copyright cell wins.

The ShapeKeywords cell, on the other hand, can be written to many times.

I am not sure what use I will put this knowledge too, but I thought I would write them down for others to ponder….

Posted in Visio. Tags: . 1 Comment »

One Response to “The Hidden Master Cells – ShapeKeywords and Copyright”

  1. Nick Says:

    Printing question. How do we get VISIO to remember the printer and printing settings for large format drawings?

    Details:
    Printers available
    —————
    Default printer: Xerox WorkCenter 7545 PS
    Paper options:
    ..Letter 8.5×11″
    ..Legal 8.5×14″
    ..Tabloid 11×17″

    Specialty printer: RICHO Aficio MP W3601 PS
    Paper options:
    .. Roll fed. Must be 36″ wide or the print job will be rejected. (ex. A 34″ wide print will be rejected)
    .. Either 36″x48″ or 36″x24″

    Drawing
    ————
    A large format 36″x48″ drawing.

    Problem
    ———–
    VISIO does not remember the printer needed for the large format drawing.

    When the file is opened, the selected printer will be the last printer used (typically the 8.5×11″ default printer).

    This means that the printer settings have to be reset each time.

    There does not seem to be an option to select a printer via “Page Setup”.

    The page size options available are only those available on the currently selected printer.

    To switch to the correct printer, it seems that I have to initiate a “Print”, select the printer, and then a “Close”.

    I then have to go through the effort of resetting the ‘Page Settings’ because some of the settings invariably seem to have been changed.

    It seems that I should be able to specify the printer I want to use for a particular specialty drawing and have VISIO remember those settings for the next time I edit that drawing.

    This seems to be the same question:
    http://answers.microsoft.com/en-us/office/forum/office_2010-visio/visio-select-default-printer/73249d79-1476-4115-9058-fe55a66e7892

    Does the “Maps and Floor Plans” / “Building Plan” / “resources” / Printer shape you talked about resolve this issue if it is dropped into a drawing.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

davecra.wordpress.com/

Microsoft Office Development, and more...

PowerShell.Amsterdam

Automate, Accelerate, Accurate

johnvisiomvp

Life with Visio and other Microsoft Toys!

Title (Required)

Windows Server Essentials Tips & Tricks

Nilsandrey's Weblog

Just another WordPress.com weblog

Things that Should be Easy

Every so often (too often in the IT industry) I encounter things that should have been very easy to do but turned out to be far too complicated. My favorite topics include SharePoint, .Net development, and software architecture, especially distributed systems.

Visio Guy

Shapes, Stencils, Drawings Templates, Tutorials, Tips & Developer Info for Microsoft Visio

Hannes's Virtual Earth

Tips & Tricks around Mapping and Cloud Computing

Pluralsight blog

be smart, be clear, be visual ...

%d bloggers like this: