Chris Hopkins' Blog - #makinitdostuff

The place where I post information about the products I manage; SharePoint, Yammer, Project and Visio and maybe from some that I don't!

Visio Slide Show

Visio Slide Show

Rate This
  • Comments 9

(updated 6/11/09 – added support for a dialog to allow you to set the interval between slides)

Recently I was asked if it was possible to set a timer to automatically switch to the next page when in full screen mode, producing a slide show style presentation mode.

I decided to do this using VBA as this code can easily be added to any Visio document that needs this functionality.

FYI, when the slide show macro is running and the last page in the document is reached, the slide show will continue with the first page via a continuous loop.

To add this functionality to your document:

  1. Open your document
  2. Open the Visual Basic editor, ALT + F11 or from the Tools > Macro > Visual Basic Editor menu item
  3. Paste the code below into the ThisDocument module via the Visual Basic editor

    1. By default the editor opens the ThisDocument module.

      image

Start the slide show

From the Tools > Macros > ThisDocument menu select StartSlideShow

image

Stop the slide show

Simply press the ESC key.  This will exit full screen mode and also trigger the timer in the macro to stop, returning you to the Visio application window.

Set the Interval

From the Tools >Macros > ThisDocument menu select SetInterval

image 

Download the Visio diagram that contains this code here.

Here is the VBA code:

Option Explicit

Private WithEvents g_vsoApplication As Visio.Application

Private g_interval As Integer
Private Const DEFAULT_INTERVAL As Integer = 5

Private g_fullScreen As Boolean

Public Sub SetInterval()

    Dim entryVal As String
    Dim entryError As Boolean
   
reEnterValue:
   
    ' init our error flag
    entryError = False
   
    ' determine if we show the default value or the last entered value
    Dim initVal As Integer
   
    If Not (g_interval = DEFAULT_INTERVAL) And Not (g_interval = 0) Then
        initVal = g_interval
    Else
        initVal = DEFAULT_INTERVAL
    End If
   
    ' get a new value from the user
    entryVal = InputBox("Enter the interval (in seconds 1 - 60)", "Set Slide Show interval", initVal)
   
    If Len(entryVal) = 0 Then
        ' the user pressed cancel
        Exit Sub
    End If
   
    Dim tmpInterval As Integer
   
    If IsNumeric(entryVal) Then

        tmpInterval = Conversion.CInt(entryVal)
       
        If tmpInterval < 1 Or tmpInterval > 60 Then
            entryError = True
        End If

    Else
   
        entryError = True
   
    End If
   
    If entryError Then
   
        MsgBox "Please enter a value between 1 - 60"
        GoTo reEnterValue
       
    End If

    g_interval = tmpInterval

End Sub

Public Sub StartSlideShow()

    Set g_vsoApplication = Application

    Dim iNextPage As Integer
    iNextPage = 1
   
    ' set the first page
    ActiveWindow.Page = ThisDocument.Pages(iNextPage)

    ' enter full screen mode
    Application.DoCmd visCmdFullScreenMode

    g_fullScreen = True

    Do While g_fullScreen

        ' start timer
        Dim pTime, pStart, pEnd, tTime, lTime
       
        'five second loop
        pTime = g_interval
        pStart = Timer
       
        Do While (Timer < pStart + pTime) And g_fullScreen = True
            DoEvents
            lTime = (pStart + pTime) - Timer
        Loop
       
        ' get the next page index that we need to switch to
        If iNextPage = ThisDocument.Pages.Count Then
            iNextPage = 0
        End If
       
        iNextPage = iNextPage + 1
       
        ' get the next page and switch to it
        Dim vsoNextPage As Visio.Page
        Set vsoNextPage = ThisDocument.Pages(iNextPage)
        ActiveWindow.Page = vsoNextPage
       
        ' reset timer
        pEnd = Timer
        tTime = pEnd - pStart
   
    Loop
   
End Sub

Private Sub g_vsoApplication_KeyPress(ByVal KeyAscii As Long, CancelDefault As Boolean)

    ' kill the code on any keypress
    g_fullScreen = False

End Sub

Attachment: Visio Slide Show Code.zip
Leave a Comment
  • Please add 8 and 7 and type the answer here:
  • Post
  • PingBack from http://microsoft-sharepoint.simplynetdev.com/visio-slide-show/

  • FYI: the original Visio "PowerPoint" slide show:

    <a href="http://visguy.com/vgforum/index.php?topic=812.0">Visio 1.0 Takes-on Microsoft Powerpoint</a>

  • FYI: the original Visio "PowerPoint" slide show:

    Visio 1.0 Takes-on Microsoft Powerpoint:

    http://visguy.com/vgforum/index.php?topic=812.0

  • Hi, I've created a visio slideshow, integrated with Operations Manager add-in to show the state of some servers of our company for our managers. The problem is that when the macro "StartSlideShow" is running, operations manager data doesn't refresh until i stop the macro.

    Any ideas to have this slideshow updating with operations manager datasource? (obvisually the add-in is configured to auto-refresh every 60 secs.

    thanks!

  • Hi,

    I have the same problem as Kristian, is there a solution to updating the diagrams state while in the slide show?

    Thanks

    Nic

  • Does someone find a r solution for scom addin problem ?

    Michael

  • Someone has a solution with the problem SCOM?

    Benoît

  • Same problem here...Trying to achieve the same result with AutoIt. Any one found a solution?

  • Now that most of the dashboards are published to SharePoint (in my case SP2010) is there a way to have all the dashboards loop or work like a slide show?

Page 1 of 1 (9 items)