Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6180083
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T00:47:02+00:00 2026-05-24T00:47:02+00:00

I am making my first Powerpoint 2007 macro and I am having a bit

  • 0

I am making my first Powerpoint 2007 macro and I am having a bit of trouble with it hanging, and not letting me move on to the next slide. I can press ESCAPE to quit the slideshow, but pressing space bar or anything else won’t progress to the next slide. After a while, it just crashes. I come from a C++/Java background so I think its just something basic that I’m missing.

Basically I am trying to do a counter slide that counts the days/minutes/seconds from a particular date. When the slide loads I want it to show, in real time, how long its been since that date. I’ve put it through an infinite loop, which works fine to update the time, but then doesnt let me move on to the next slide.

Here’s my code:

    Sub OnSlideShowPageChange(ByVal SSW As SlideShowWindow)
    'If SSW.View.CurrentShowPosition = 3 Then
    Do While SSW.View.CurrentShowPosition = 3    ' infinite loop
        Dim currentSlide As Integer
        currentSlide = SSW.View.CurrentShowPosition

        Dim startDate As Date
        Dim currentDate As Date
        Dim sngDiff As Single
        Dim lngDays As Long
        Dim lngHours As Long
        Dim lngMinutes As Long
        Dim lngSeconds As Long

        startDate = #7/22/2011 2:00:00 PM#
        currentDate = Now

        sngDiff = currentDate - startDate
        lngDays = CLng(sngDiff)
        sngDiff = sngDiff - lngDays
        lngHours = Hour(sngDiff)
        lngMinutes = Minute(sngDiff)
        lngSeconds = Second(sngDiff)

        With ActivePresentation.Slides(currentSlide)
            With .Shapes(2)
            .TextFrame.TextRange.Text = "It has been:" & lngDays & " Days " & lngHours & " hours " & lngMinutes & " minutes " & lngSeconds & " Seconds"
            End With
        End With

    DoEvents
    Loop
End Sub

Do I need to listen for some sort of button click to stop this infinite loop, or how do I do this?

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T00:47:04+00:00Added an answer on May 24, 2026 at 12:47 am

    A user form is something you add in the VBA editor; it’s what you’d normally think of as a dialog box, though forms can be used for other things and needn’t even become visible; that’s what we’re going to do here:

    Option Explicit
    Public bFormCodeRunning As Boolean
    
    Sub FormDemo()
    
    ' Set a flag to let us know the code in the form
    ' is running
    bFormCodeRunning = True
    
    ' "show" the form
    UserForm1.Show vbModeless
    
    
    End Sub
    
    Sub KillForm()
    ' call this at some other point in the presentation
    ' when you're sure you're done running the form code
    
    If Not bFormCodeRunning Then
        Unload UserForm1
    End If
    
    ' You could actually call this from your slide change event handler
    
    End Sub
    

    Then Insert, User Form from the menu to add a new form; doubleclick it to view its code and add this:

    Private Sub UserForm_Activate()
    
        ' Don't show my face
        Me.hide
        DoEvents
    
        ' prove that the form's loaded
        MsgBox "I'm well-formed"
    
        DoEvents
        ' and put your other code here
    
        ' and when the code's done, flag it
        bFormCodeRunning = False
    
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm making my first foray into WPF - I have a simple form with
I'm making my first iOS App, and I'm facing my first (little) issue. The
I'm making some first steps in Typo3 and am currently trying to make a
So, I'm making my first MySQL function. BEGIN DECLARE ID INT; SELECT LandID INTO
Making echo of a question around the web: Is the syntax for svn:ignore patterns
When making changes using SubmitChanges() , LINQ sometimes dies with a ChangeConflictException exception with
After making some changes in my models (eg. new field in a model and
After making a few modifications to a rails app I am tinkering on, railroad
Im making a small python script to upload files on the net. The script
I've been making a concerted effort to improve my javascript skills lately by reading

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.