Macros stop suddenly?

P

phantoz

First off, I'm a powerpoint/vba newb running 2003.

I have a presentation with one module, and the following code:

Sub LogInformation(LogMessage As String)
'stolen, here's credit:
http://www.exceltip.com/st/Log_files_using_VBA_in_Microsoft_Excel/493.html

Const LogFileName As String = "log.txt"
Dim FileNum As Integer
FileNum = FreeFile ' next file number
Open LogFileName For Append As #FileNum ' creates the file if it doesn't
exist
Print #FileNum, LogMessage ' write information at the end of the text file
Close #FileNum ' close the file
End Sub

Sub SlideChange()
LogInformation Now & ActiveWindow.View.Slide.SlideIndex
End Sub

Sub SlideChangeForeward()
ActivePresentation.SlideShowWindow.View.GotoSlide
(ActivePresentation.SlideShowWindow.View.Slide.SlideIndex + 1)
SlideChange
End Sub

Sub SlideChangeBackward()
ActivePresentation.SlideShowWindow.View.GotoSlide
(ActivePresentation.SlideShowWindow.View.Slide.SlideIndex - 1)
SlideChange
End Sub



On the slide master I have two action buttons that are linked to
SlideChangeBackward() and SlideChangeForeward(). When these buttons are hit
only the first line of the macro they are associated with executes. For
instance, I changed one macro around to:


Sub SlideChangeBackward()
SlideChange
ActivePresentation.SlideShowWindow.View.GotoSlide
(ActivePresentation.SlideShowWindow.View.Slide.SlideIndex - 1)
End Sub

And I got the timestamp and slide number in a file, but didn't get pushed to
the next slide.

Anyone have any idea why this might be happening?

And an easier question - can anyone tell me how to conver "Now" to seconds
since 1970?

thx in advance,

p
 
D

David M. Marcovitz

With a very quick perusal, ActiveWindow catches my eye in the SlideChange
procedure. That is usually used in Edit view, not Slide Show view. What
happens if you change that to ActivePresentation.SlideShowWindow like you
have everywhere else?
--David

--
David M. Marcovitz
Microsoft PowerPoint MVP
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top