Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PowerPoint (VBA?) fading in and out text

Tags:

powerpoint

vba

Attempting my first go at VBA within PPT, done a little in Excel before.. but I need some help on where to go with this one...

I have a list of a hundred or so strings, that I want to fade in and out, on the same slide after about 3 or secounds of displaying 1 at a time. And to keep doing it until stopped by the user ie CTRL + break. I have a a little of the coding so far, but not sure where to go from here...

Option Explicit
Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Sub Test()
'Start the presentation
ActivePresentation.SlideShowSettings.Run

'Change the value of the text box to String1 and fade in the text
ActivePresentation.Slides(1).Shapes(1).TextFrame.TextRange.Text = "String1"

DoEvents

'Wait 2 secounds, fade out the Hello! Sting

Sleep 2000

'Fade in the new string.. String2!
 ActivePresentation.Slides(1).Shapes(1).TextFrame.TextRange.Text = "String2"

DoEvents

'A Loop to keep going back and forth between the 2 (there will be many more later....
'Until stoped by the user [CTRL + BREAK]

End Sub

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

Sub Test()
'Start the presentation
ActivePresentation.SlideShowSettings.Run

'Change the value of the text box to String1 and fade in the text
ActivePresentation.Slides(1).Shapes(1).TextFrame.TextRange.Text = "String1"

DoEvents
'Wait 2 secounds, fade out the Hello! Sting

Sleep 2000

'Fade in the new string.. String2!
ActivePresentation.Slides(1).Shapes(1).TextFrame.TextRange.Text = "String2"

DoEvents

'A Loop to keep going back and forth between the 2 (there will be many more later....
'Until stoped by the user [CTRL + BREAK]

End Sub

I really appreciate any help the forum / people can provide.. thank you!!

Skyhawk

like image 708
user616270 Avatar asked Dec 08 '25 12:12

user616270


1 Answers

You should use normal animation instead of VBA.

Make two identical textboxes with different texts, then fade in on and fade out the other.

like image 81
SLaks Avatar answered Dec 11 '25 05:12

SLaks



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!