0
votes

My first post, apologies if I've missed something obvious here, or made an unintentional repeat issue that's been addressed recently.

So I'm working on a presentation in PowerPoint 2016:

  • My presentation is saved as macro-enabled.
  • Macros are enabled in macro security.
  • The slideshow is going to run on a large monitor 24/7.
  • Whilst running, there will be no human interaction.
  • The Slideshow will run for up to a full month before it is updated with new news/information.

What I am trying to do:

So the slide in position 28, is a "Days Since Last Lost-Time Accident" slide.

My macro for updating a text box works beautifully if fired manually, I post this part so you can see exactly what I am trying to trigger.

Sub Countup()
Dim thedate As Date
Dim daycount As Long
Dim Icount As Integer
ActivePresentation.Slides(28).Shapes("LTAno").Select
thedate = "10/04/2017"
daycount = DateDiff("d", thedate, Now)
ActivePresentation.Slides(28).Shapes("LTAno").TextFrame.TextRange.Text = daycount
End Sub

Above this - (these two parts are in a module) - is the problem code:

Public Sub OnSlideShowPageChange(ByVal SSW As SlideShowWindow)
If SSW.View.CurrentShowPosition = 28 Then
Call Countup
End If
End Sub

I checked to make sure that slide 28 was indeed slide 28 by using a msgbox, and that popped up no problem. So I changed the msgbox line to the CALL function.

I think that is where my problem is? My head hurts... Could anyone point me in the right direction? :)

No matter how I start the slideshow, the number on the slide will not update unless I fire the macro by hand.

1

1 Answers

1
votes

Don't "select" the shape. For example:

Sub Countup()
    Dim thedate As Date
    Dim daycount As Long
    Dim Icount As Integer
    Dim vShape 
    Set vShape = ActivePresentation.Slides(28).Shapes("LTAno")
    thedate = "10/04/2017"
    daycount = DateDiff("d", thedate, Now)
    vShape.TextFrame.TextRange.Text = daycount
End Sub