hyperlinking index

Public Schedule Face-to-Face & Virtual Instructor-Led Training - View dates & book

Forum home » Delegate support and help forum » Microsoft Visio Training and help » Hyperlinking an index

Hyperlinking an index

resolvedResolved · High Priority · Version 2013

Pamela has attended:
Excel Intermediate course
Excel Advanced course
Excel Advanced course
Emotional Intelligence at Work course

Hyperlinking an index

Hi there

I have a large Visio document with around 50 tabs.
I would like to insert an index whereby the user can be taken to the corresponding tab with one click of an item on that index listing.
My solution so far has been to insert 50 text boxes, each with their own hyperlink. This is very time consuming.
Is there a more effective way of doing this without having to insert 50 text boxes with individual hyperlinks linking to each tab option?

Thanks

Pamela

RE: Hyperlinking an index

Hi Pamela,

Thank you for your question. Visio doesn’t have a Table of Contents tool like Word has. We have to use a work-around to get the job done. You can do this by using a macro (don’t worry, it’s not that hard).

Below are the steps and the code you can use to create a ‘Table of Contents’:

How to use:
1. Open your Visio document.
2. Press Alt + F11 to launch the Visual Basic Editor (VBE).
3. Select Insert>Module from the Menu Bar in the VBE.
4. Copy the code from below.
5. Paste the code in the right hand window of the VBE.
6. Close the VBE.
7. From the Visio document, select Tools>Macro>Macros (or press Alt + F8).
8. Highlight TableOfContents in the list of macros.
9. Press run.

Test the code:
1. Open the example file.
2. Insert a page in the example file.
3. Run the TableOfContents macro per the instructions above.
4. Notice that the page you added is now listed in the Table of Contents.
5. When you are convinced that it works right, place the code in your document and run it.

Below is the actual code. You should only need to run the macro once (steps above). The macro will create buttons on the first page (initially all on top of each other). You will need to rearrange them manually. To use the buttons, run Visio in Presentation Mode (F5)


Option Explicit

Sub TableOfContents()
' creates a shape for each page in the drawing on the first page of the drawing
' then add a dbl-clk GoTo to each shape so you can double click and go to that Page

Dim PageObj As Visio.Page
Dim TOCEntry As Visio.Shape
Dim CellObj As Visio.Cell
Dim PosY As Double
Dim PageCnt As Double

' ActiveDocument.Pages.Count will give the number of pages, but we are interested
' the number of foreground pages
PageCnt = 0
For Each PageObj In ActiveDocument.Pages
If PageObj.Background = False Then PageCnt = PageCnt + 1
Next

' loop through all the pages
For Each PageObj In ActiveDocument.Pages
If PageObj.Background = False Then ' Only foreground pages

' where to put the entry on the page?
PosY = (PageCnt - PageObj.Index) / 4 + 1

' draw a rectangle for each page to hold the text
Set TOCEntry = ActiveDocument.Pages(1).DrawRectangle(1, PosY, 4, PosY + 0.25)

' write the page name in the rectangle
TOCEntry.Text = PageObj.Name

' add a link to point to the page to you can just go there with a Double Click
Set CellObj = TOCEntry.CellsSRC(visSectionObject, visRowEvent, visEvtCellDblClick) 'Start
CellObj.Formula = "GOTOPAGE(""" + PageObj.Name + """)"

End If
Next

'Clean Up
Set CellObj = Nothing
Set TOCEntry = Nothing
Set PageObj = Nothing
End Sub


When it works and you want to save the drawing, you need to save it as a Visio Macro-Enabled Drawing, otherwise you lose the macro.

It works for me, I hope it will for you!

Kind regards
Marius Barnard
Trainer
Best STL

RE: Hyperlinking an index

Hi There

Many for your answer Marius - most helpful, and it did work! So all my tabs are linked to my first tab (contents page) with the 'Macro' within Visio.

The problem is, that I want to distribute this Visio workbook in PDF format. Now when I 'save as' PDF, the hyperlinks I manually inserted on my maps continue to work in PDF format.
However the links do not translate onto the PDF format for the 'Macro' enabled contents page.
How can I get the links for this contents page to translate into PDF format?

Best wishes


Pamela

RE: Hyperlinking an index

Hi Pamela,

The best solution will be to manually link the content shapes created by the macro to the various pages. I know it's going to take a bit of time but it will allow you to use them in PDF.

You right-click a page link shape on the Contents page, then select Hyperlink. In the dialogue box, click in the Sub-address field, then click Browse. Here you select the relevant page to link to.

When you save the drawing as PDF, you can keep using the links.

Kind regards
Marius

RE: Hyperlinking an index

OK - thanks for you help!

Wed 17 Feb 2016: Automatically marked as resolved.

 

Training courses

 

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.


 

Visio tip:

Using the Quick Access Toolbar in Visio 2010

The Quick Access Toolbar is included in virtually every Office product, including Visio 2010 as well as Outlook 2010, Word 2010, Excel 2010, and PowerPoint 2010.

You will find the Quick Access Toolbar in the top-left side of the window. To begin, click the Customize button (it's the little black arrow at the end of the toolbar).

Simply click the commands you want to include.

Virtually any command can be added to the Quick Access Toolbar. Click the More Commands option and a new window will open from where you can browse the commands including those not on the ribbon.

View all Visio hints and tips


Server loaded in 0.07 secs.

✓ w3speedster