Home → Resources → Articles

Visio Macro To List Document Tabs

(Microsoft Visio,Microsoft VBA) by Jason Skowronek on 06/17/2010

I wrote up quickly to throw a sequential list of all the tabs (pages) of a Microsoft Visio document into a Shape (e.g. table of contents).

  1. Create your overview page
  2. Drop a shape onto the canvas
  3. Open the shape sheet and assign the sheet a name (mine is called "Tabs")
  4. Open the VBA editor (ALT + F11)
  5. Paste the code from below into your document's code window
  6. Make sure the name of your shape matches the Shape reference in the code
  7. Right-click the shape and assign a macro behavior to the new macro/method
  8. Double-click the shape
  9. You're welcome
Public Sub FillOverViewPage()
    Dim vsoChars As Visio.Characters
    Dim vsoPages As Visio.Pages
    Dim i As Integer
    Set vsoPages = Me.Pages
    Set vsoChars = Me.Pages(1).Shapes("Tabs").Characters
    ' clear whats in there now
    vsoChars.Text = ""
    ' loop pages and add page name to the chars
    For i = 1 To vsoPages.Count
        If vsoPages(i).Background = False Then
            vsoChars.Text = vsoChars.Text & i & " - " & vsoPages(i).Name & vbCrLf
        End If
    Next i
End Sub

SkoNet provides comprehensive digital consulting services such as: web development, applications development, database design and architecture, business process management, customer relationship management, and many others that help businesses of every size, industry, and geography meet the complex challenge of managing and sharing information on the web. Our skills and expertise in online systems allow us to help customers build applications ranging from simple, single-page web sites to robust enterprise systems.

Online Backup, Ektron Consulting, Ektron Programmer, Ektron Developer, Ektron Partner Utah, Ektron Partner, Ektron Architect, Ektron Hosting, Salesforce.com Consultant Utah, Salesforce.com Partner Utah, Salesforce.com Partner, Salesforce.com Programmer, Salesforce.com Architect, Salesforce.com APEX Programmer