VBA Timer

  • Thread starter Thread starter Jason Lopez
  • Start date Start date
J

Jason Lopez

I need to add a timer on a single slide. I know that I could make a timer
out of multiple slides. But that is a waste of memory space (IMO) for a
presentation. I saw that someone created a presentation with a single slide
timer using VBA. But, can someone point me in the direction of where I can
get an understanding of how they did this and I can write my own macro code
for it?

Jason Lopez
 
John, depending on the version of PowerPoint (i.e. 2007) I have been having
problems getting Shyam code to work, I get an error message from the public
declaration of the sleep lib. used in the TMR sub. The second part works but
may need a screen refresh after a time delay.

Thank,
Chuck
 
John, depending on the version of PowerPoint (i.e. 2007) I have been having
problems getting Shyam code to work, I get an error message from the public
declaration of the sleep lib. used in the TMR sub.

Ah. That means that something's wrong.

Hint: Always quote the exact text of the error message; that gives us something to
grab hold of. The fact that there was an error message doesn't tell us much.

But now that I've lengthened your leg, you may want to try re-copying the
declaration from Shyam's page. Here 'tis to save you the trouble of looking it up:

Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

There's nothing wrong with it ... it works fine here.



The second part works but
 
Steve, sorry to take so long to get back to you, I did copy the whole section
of code into a new presentation.

The error message is:
"Compile error:
Constants, fixed-length strings, arrays, user-defined types and Declare
statements not allowed as Public members of object module."

The problem may have something to do with the company (IT) settings, but
appear after going to Powerpoint 2007 running on XP pro and new computers.

A old presentation that worked fine in 2003 has the same declaration for
Sleep lib works erratically, i.e. 1 second delay may be 3 seconds long and
after a DoEvent I have trouble getting the screen refreshed, i.e.
With ActivePresentation.Slides(1)
.Shapes("C1").Visible = Reset1
.Shapes("C17").Visible = Reset1
If Aux1 Then
.Shapes("C8").Visible = True
.Shapes("C7").Visible = False
Else
.Shapes("C7").Visible = True
DoEvents
If Reset1 Then
Sleep 500
End If
.Shapes("C8").Visible = False
End If

the last shape will not appear.

Thanks, Chuck
 
Back
Top