Hello,
Sure, I can provide you with an example VB macro for PowerPoint that sets the animation of a selected text box to appear by letter at a speed of 0.01 letter per second. Please follow these steps:
Open your PowerPoint presentation and press "Alt + F11" to open the Visual Basic for Applications (VBA) editor.
In the VBA editor, click on "Insert" from the menu, then choose "Module" to insert a new module.
In the module window, paste the following VB macro code:
Sub AnimateTextByLetter()
Dim slide As Slide
Dim shape As Shape
Dim effect As Effect
' Check if a shape (text box) is selected
If Not ActiveWindow.Selection.Type = ppSelectionShapes Then
MsgBox "Please select a text box (shape) to animate.", vbExclamation, "No Text Box Selected"
Exit Sub
End If
' Get the selected shape
Set shape = ActiveWindow.Selection.ShapeRange(1)
' Check if the selected shape is a text box
If shape.Type <> msoTextBox Then
MsgBox "Please select a text box (shape) to animate.", vbExclamation, "Invalid Shape Type"
Exit Sub
End If
' Add an Appear animation effect to the shape
Set slide = shape.Parent
Set effect = slide.TimeLine.MainSequence.AddEffect(Shape:=shape, effectId:=msoAnimEffectAppear)
' Set the animation properties
With effect
.TextUnitEffect = msoAnimTextUnitEffectByLetter
.Timing.Duration = 0.01
End With
' Play the animation
slide.TimeLine.MainSequence.Play
End Sub
Close the VBA editor by clicking the "X" button or pressing "Alt + Q."
Now, you can use this macro to animate a selected text box in your PowerPoint presentation:
Select the text box you want to animate.
Press "Alt + F8" to open the "Macro" dialog box.
Select the "AnimateTextByLetter" macro from the list and click "Run."
The selected text box will now have an Appear animation with each letter appearing at a speed of 0.01 letter per second.
Please note that this macro assumes you are using PowerPoint 2018 for Windows. The macro should work for most versions of PowerPoint, but there might be slight variations in the user interface or object model for different versions. Also, be cautious when running macros, especially from unknown sources, as they can potentially harm your presentation or computer. Always make sure to back up your files before using any macros.
I used AI provided by ChatGPT to formulate part of this response. I have verified that the information is accurate before sharing it with you.
Hope this resolves your Query !!
--If the reply is helpful, please Upvote and Accept it as an answer–
VB Macro for PowerPoint text Animation
Garrod Hutchison
0
Reputation points
I want to create a simple VB Macro in PowerPoint 2018 for Windows that sets the animation of a selected text box to appear by letter at a speed of 0.01 letter per second. Can anyone help with an example
1 answer
Sort by: Most helpful
-
Limitless Technology 44,681 Reputation points
2023-07-31T10:53:04.2233333+00:00