Visio and IA Tip - hide and show annotations
Here’s my latest useful visio trick - a macro that hides and shows annotations on all sheets at once (it hides them for view and print). Very useful when you want to print everything with or without annotations. Label your annotation layer “annotation” or change the annotation to reflect what you usually call that layer.
Let me know if this is useful or if there is a better way of doing it
Public Sub HideAnnotationLayers() Dim layer As Visio.layer Dim PageToIndex As Visio.Page Dim curPage As Visio.Page Dim layerObjVisCell As Cell Dim layerObjPrintCell As Cell Set curPage = ActivePage For Each PageToIndex In ActiveDocument.Pages ActiveWindow.Page = ActiveDocument.Pages(PageToIndex.Index).Name For Each layer In Visio.ActivePage.Layers If (layer.Name = "Annotation") Then Set layerObjVisCell = layer.CellsC(visLayerVisible) Set layerObjPrintCell = layer.CellsC(visLayerPrint) layerObjVisCell.Formula = 0 layerObjPrintCell.Formula = 0 End If Next Next ActiveWindow.Page = curPage End Sub
Public Sub ShowAnnotationLayers() Dim layer As Visio.layer Dim PageToIndex As Visio.Page Dim curPage As Visio.Page Dim layerObjVisCell As Cell Dim layerObjPrintCell As Cell Set curPage = ActivePage For Each PageToIndex In ActiveDocument.Pages ActiveWindow.Page = ActiveDocument.Pages(PageToIndex.Index).Name For Each layer In Visio.ActivePage.Layers If (layer.Name = "Annotation") Then Set layerObjVisCell = layer.CellsC(visLayerVisible) Set layerObjPrintCell = layer.CellsC(visLayerPrint) layerObjVisCell.Formula = 1 layerObjPrintCell.Formula = 1 End If Next Next ActiveWindow.Page = curPage End Sub
May 7th, 2006 at 12:00 pm
Hi Donna
I have not used Visio yet, but am wondering if it would be useful for a project I am working on at the moment.
I’m looking for an app you could use for a sitemap (tree style) that would keep an ID number, URL, and title for each page, for say 500 - 1200 pages. And with the ability to collapse / open nodes.
Is this something you would expect to be able to do with Visio?
Cheers
May 9th, 2006 at 9:11 pm
I’d do that in Excel - use the group feature to expand and collapse.
July 18th, 2006 at 7:21 am
Great macro! I’ve wanted to figure out how to do this for a while. Thanks!
October 27th, 2007 at 9:20 am
I agree that Visio needs this functionality built in! Of COURSE, users want to hide them on every page, or show them on every page most often!!! LOL
However, I’ve found a work-around that I’m quite happy with. It involves creating a PDF.
Adobe Acrobat writer 8.0 allows you to maintain layers. Then, when you view the document in Acrobat reader 8.0, you can display a layers tab, much like the bookmarks tab. You can hide and show each layer throughout the document. It’s very cool for using wireframes in review sessions with the client, and then hiding the notes layers for user assessments. It’s also helpful for creating a layer to include drop-down components in the Visio, which you can turn on to show all of the drop-downs expanded at once.
June 4th, 2008 at 4:43 am
Donna,
First of all thanks for this Macro. It’s exactly what I was looking for. To a tee.
There is one very minor issue that folks should be aware of when trying to copy and paste the above item into visio: The quotation marks wrapping the string “annonation” are of the curly variety (sometimes called smartquotes), rather than straight. The macro will not run as intended unless you change the quotation marks to straight quotes in your VB editor.
Thank you.
Yaniv Nord
Brooklyn, New York
June 4th, 2008 at 8:25 am
Thanks Yaniv. I think I’ve fixed that.