Visio SmartShapes don’t aren’t just for enhancing your Visio diagrams. They can be put to work as tools too!
Find out how such a Shape Tool can help you navigate multi-page Visio documents with ease!
Many Pages Hard to Navigate
If you have Visio documents with lots of pages, you know that navigating via page tabs is less than ideal.
Sure, the page tabs have the forward, back, fast forward and rewind buttons, but if you have 15 pages or more, getting to the ones in the middle will require a bunch of annoying clicks. And if you have to jump a lot, this gets old quickly.
Menus help a little. Edit > Go To shows you a list of pages in a cascading sub-menu. But only up to eight. If you have more pages than that, you’ll have to fire up a dialog using the Page… option at the end of the Go To menu. where you can choose from a nifty list of all pages in your document:
This works well, but you still have to dig into two levels of menus every time you want to navigate. In Visio 2010, you’ll have to customize the ribbon before the Go To command is even available to you!
The Drawing Explorer window can also help you out:
When you click on a page node, the corresponding page is immediately shown in the drawing window. But it too quickly runs out of space and requires scrolling. Plus, you lose a bunch of screen real-estate by having this window displayed. Not a good use of the your Visio window if you’re using the explorer just for jumping pages. In Visio 2010, the Document Explorer is hard to find. It requires the Developer tab to be visible, which requires a trip to the Backstage area to customize the ribbon.
Use SmartShapes as Tools
In dealing with these shortcomings for a customer, I came up with an odd technique that is simple and effective.
I created a Visio SmartShape that acts as a tool. Just a simple shape that functions as a button to quickly get you to the Page dialog. The shape isn’t intended to be part of the diagram, but just a shortcut or button that can be placed on any or all pages, in any location. The shape could just be a simple rectangle, but I like to make it look a bit fancier, and more button-like. Here’s one I’ve created:
To make the shape work, we need to add a few ShapeSheet functions to it. Mainly, we’ll use the DOCMD function to invoke the Page dialog.
It turns out that DOCM(1077) calls up the Page dialog, and we hook this function up to the double-click event for the shape. Here’s a run-down of the ShapeSheet cells that I edited for my page-jumping shape:
In the Events section:
EventDblClick = DOCMD(1077)
Now a double-click will pop-up the Page dialog. Super simple!
In the Miscellaneous section:
NonPrinting =TRUE
Comment =”Double-click to jump to a page in this document by choosing from a pop-up list of pages.”
With NonPrinting set to TRUE, the shape won’t print, and our diagrams will stay clean. Now you can leave the button shape laying around wherever you want without worrying about it messing up any of your published output!
The Comment cell shows us a ScreenTip when we hover the mouse over the shape:
You can also set comments inserting a ScreenTip from the Insert menu, but since we were already in the ShapeSheet…
Now when we double-click the shape, we’ll immediately see the Page dialog:
Where we can double-click one of the pages in the list and immediately jump to it!
One other question my customer had was: “How do I make a shape that link to the last page visited?” She wanted the equivalent of the “back” functionality that you commonly find in browsers. Visio did at have some browser-like buttons at one time, and you can still find a Back function in the list of commands available for ribbon customization in Visio 2010. However, Back doesn’t work if you use the Page dialog to navigate. It only works if you jumped to a page using a hyperlink.
There are likely corresponding DOCMDs for Forward and Back available, so perhaps a system of “Shape Tools” could be built that allow page navigation plus forward and back behavior. If anybody figures it out, please leave a comment below telling us what you’ve found out!
Jumpy says
Don’t know ribbons, but isn’t it possible to create a button in the ribbon, or in older Versions the menu, that does the same?
In any case a good tool for people with many pages. I think it was asked about sth. like that in the forum, too.
Jumpy
Visio Guy says
Hi Jumpy,
Yes, for Visio 2010 it is pretty easy to add this to the ribbon. I think my client was either using an older version of Visio, or needed to build the functionality into existing shapes.
This article shows how to make a button shape, but you could build it into any shape, quite easily. I think that is what we ended up doing.
Visio Tart says
Greetings Chris lad!
Standard Windows users are generally not used to having to “double-click” on anything to activate a button. Since Visio allows the addition of an ActiveX control on the page, you can use a VBA Forms Button (found in Visio 2010 on the Developer Tab, in the Controls Area, on the Insert Item [ button control ] ) instead of a Visio SmartShape.
Each Command Button ActiveX Control would have the following code associated with it’s Click Event:
Private Sub CommandButton1_Click()
CallPageDialog
End Sub
And then a module would contain the following procedure:
Public Sub CallPageDialog()
Dim appVisio As Visio.Application
Set appVisio = Visio.Application
appVisio.DoCmd (visCmdOptionsGoToDrawing)
End Sub
I’ll send along a Visio diagram with all of this in place.
David (The Visio Tart) Edson
Visio Guy says
Thanks David!
Extra points for posting code, too!
I figured anybody who actually does this is a “non-standard” Windows users anyway. Plus I wanted to show places for navigating pages and introduce the DOCMD ShapeSheet function.
Visio Guy says
Oh, and show off a cool button shape to boot! (Note the chiseled text effect…look close!)
Roosje says
Great shape……but it doesn’t work when publishing the Visio web drawing with SharePoint 2010….
Visio Guy says
Hi Roosje,
One wouldn’t expect this to work in a web-published document.
It is using Visio facilities to do the work. When you double-click the shape, you are getting a Visio dialog box that helps you navigate to a different page, not any kind of hyperlinking functionality.
For this to work in Save as Web, then Visio would have to export itself as one huge java-script program so that all Visio functions were available in the browser! 🙂
marcus says
At first a big thanks for this page, its very intressting to read plus a very good style to from.
Is there also the possibility to change the hight or width of all available shapes on the page via such a DOCMD or something different but does the job?
Thanks in advance!
-Marcus
Visio Guy says
Hi Marcus,
For blasting new values to Width or Height, SETF would work better. For example:
EventDblClick = SETF(GETREF(Width), 15mm )
or
EventDblClick = SETF(GETREF(Width), Prop.AußenLänge )
This article: The Hidden World of Visio Shapes shows examples of SET being used to turn layer-visibility on and off, might be worth a look as well.
FreezeDK says
First of all, i often visit your GREAT site!
In Visio 2010 (new feature) you can rightclick the page tabs [forward, back, fast forward, rewind buttons] area. As in Excel (at least since 97) this will list the first few pages/tabs (9 in my window), and have a [more pages…] option below, showing the Pages dialog.
Visio Guy says
FDK,
Totally cool tip. I usually right-click just about everything, but I missed right-clicking on the forward/backward buttons in Visio 2010.
Thanks!
Chris
visualthing says
In addition to right-clicking on the left/right page buttons and choosing [More pages…], you can launch the Page dialog by simply clicking on the page number.
In Visio 2010 (at least) all it takes is a single left-click where it says “Page x of y.”
Many thanks for a truly indispensable site.
–Mac
Visio Guy says
Nice tip, VT, thanks!
Shane says
Does anyone know how to restore the double-click hyperlink function from Visio 2007 in Visio 2010?
In 2007 I could simply right click on any object and select a double-click action, now stupidly MS has removed this feature so if you open a Visio 2007 doc in 2010 the hyperlinks don’t work and just produce errors!!! WTF??? What’s wrong with MS development? How come they still keep making these stupid mistakes?
Please heeelllppp???? Tks.
Visio Guy says
Hi Shane,
1. Right-click on the Ribbon and choose “Customize Quick Access Toolbar”.
2. Choose “All Commands” in the top-left drop-down.
3. Find “Behavior…” in the list, and Add >> it to the list on the right, then click OK.
4. Select a shape, then click the new Behavior button in the QAT. You’ll find the familiar Double-Click tab in the dialog that appears.
Jordan says
I’ve just been clicking on the “Page of ” in the very bottom left of the screen to pop up this menu. I’ve also found that ctrl + Z will jump me back to my previous page (provided I haven’t done anything since coming to the current page), and ctrl + Y does the same for jumping forward (again, providing I haven’t done anything since jumping back)
Hans Jensen says
This is a very cool tip on how to use shapes for actions, and also on how to make the shapes invisible to printout. Thank you for sharing!
Ted Calloway says
Does anyone know how to print a list of Visio pages? I have a Visio document with almost 200 pages. It would be great to be able to create a list in Excel or Word to track certain metadata about all of the pages.
Thanks
Visio Guy says
Hi Ted,
If you are a bit handy running a VBA macro, this code will list your pages in the Immediate window of Visio’s VBA editor:
[code lang=”vb”]
Sub PrintPageNames()
Dim doc As Visio.Document
Set doc = Visio.ActiveDocument
Dim pg As Visio.Page
For Each pg In doc.Pages
Debug.Print pg.Name
Next
End Sub
[/code]
From Excel, with the Visio document open, this code will list the page names in column A:
[code lang=”vb”]
Sub PrintPageNamesInExcel()
Dim visApp
Set visApp = GetObject(, "visio.application")
Dim visDoc
Set visDoc = visApp.ActiveDocument
Dim xlWksht As Excel.Worksheet
Set xlWksht = Excel.ActiveSheet
Dim iRow As Integer
iRow = 1
xlWksht.Cells(iRow, 1).Value = "Page Name"
Dim visPg
For Each visPg In visDoc.Pages
iRow = iRow + 1
xlWksht.Cells(iRow, 1).Value = visPg.Name
Next
End Sub
[/code]
See this article for the solution to a related problem:
Export All Pages in Document
jel888 says
Follow-up question on Roosje’s point, so can you or anyone tell a non techie type how this could be done (moving from one page to another page via a click or double-click on a shape within a SP website environment (using a Visio 2010 file as the base)?
Visio Guy says
The standard hyperlinking feature should work just fine in SharePoint (I don’t have an environment handy to test).
The point of this article was to pop-up a table of pages for lengthy documents to help users jump to *any* page–a navigation helper, so to speak.
jel888 says
Thanks and though I did understand the point of the article, I figured it was best to benefit from the knowledgeable audience and yourself on a related matter. Super thanks!
Dave Mac says
There is a much easier way to accomplish this, if you don’t mind using a drop down menu from a toolbar.
1. Right-click in any blank portion of the toolbar area (or on the border of adjoining toolbars) to bring up the menu of toolbars.
2. Choose Customize… from the bottom of the menu – the only command on the menu that’s not actually a toolbar. This should bring up the Customize menu. Click on the Commands tab.
3. Click on Edit in the Categories list on the left and then scroll down to Go To Page in the Commands list on the right.
4. Drag the Go To Page command to whatever active toolbar you want it to reside in.
Now you’ll have the list of pages as a handy drop down menu right on the toolbar of your choice. Going to a page is now a simple click-select sequence.
As far as I know this is available in all versions of Visio.
Visio Guy says
Great tip, Dave M!
A B says
Hope you can help me.
Versions : Visio – 2010, Word – 2010, SharePoint 2010
I am working on a Visio diagram which will be used in Sharepoint. So I am using the Visio Web Diagram Format in Visio.
I have my different shapes connecting to bookmarks in large Word documents. When testing in Visio itself, the hyperlinks to the bookmark work correctly and take me to the page where the bookmark is defined.
When I upload the same diagram to Sharepoint and click on the same shape, it opens up the word document, but it doesn’t take me to the bookmark, It opens the document on first page.
Am I missing something in this set-up? Do I need to take any extra steps for the bookmarks to work from Sharepoint?
Steve says
I’m a huge fan of data linking shapes to databases to display shapesheet metadata. However, this quickly becomes a huge mess when more than a few shapes are linked since the shapesheet data covers large portions of the drawing.
Can someone suggest a way to use VBA to auto-hide the shapesheet data and display it only when the mouse is hovered over the shape? An example would be enormously appreciated!