How To Make A Random Rolling Dice Animation in PowerPoint Using 3D Objects & VBA

3D Objects were introduce to PowerPoint in 2016 and is available in versions 2016 and above.

Under Insert Tab | 3D Models, you can insert 3D Objects from the free library available or .OBJ files in your computer. This is how we will be adding the 3D Rolling Dice in PowerPoint.

Insert 3D Animations in PowerPoint - How To Make A Random Rolling Dice Animation In PowerPoint Using 3D Objects & VBA

There are five animations available for 3D Models in PowerPoint. We shall be using the Jump & Turn animation to fake the rolling dice animation. We shall be clubbing the Entrance: Zoom animation along with it to make it look more realistic. Using a trigger animation, both the animations will occur only when the Spin Shape is clicked.

3D Animations in PowerPoint - How To Make A Random Rolling Dice Animation In PowerPoint Using 3D Objects & VBA

Using VBA Code, we can randomize the X, Y and Z values of the 3D Object. So, on click of the Spin Shape, the following takes place:

  1. The coordinates of the 3D Object are randomised such that a dice face from 1 to 6 is shown.
  2. The trigger animation occurs and shows the rolling dice animation with the randomised coordinates of the 3D Object.

How To Make Who Wants To Be A Millionaire Quiz Game Show in PowerPoint

Let's learn how to create a PowerPoint Dice rolling animation. It is completely free and you can download the PowerPoint Dice Template that can be used in classrooms and PowerPoint Games.

✅ 3D Animated Rolling Dice Animation
✅ Randomise Dice Position using VBA

Total Time Needed: 15 minutes

Softwares:

Microsoft PowerPoint
3D Dice Model
VBA Macros

Features:

Randomised Dice
Rolling Dice Animations

Here is how we create an Interactive PowerPoint Quiz Game:

Step 1: Insert 3D Dice Model

In the first slide, go to Insert | 3D Model | From Online Sources... and search for a rolling dice. Select it and click on insert. We are going to have 2 dice in this tutorial. Make sure to change their names to dice1 and dice2 (case-sensitive). You can do this via the selection pane.

Step 2: Add Spin Button

Insert a rectangle shape and type 'Spin' in it. This will be the button that we'll click on to make the animations occur for the dice in slide-show mode.

Step 3: Rolling Dice Animation

Select the 3D Dice, go to Animations and select Entrance: Zoom animation. Then, add a 3D Animation: Jump & Turn. Select all the animations and click on Trigger | On click of... and select the 'Spin Button' which would probably be Rectangle 1.

Step 4: VBA Code to Randomize

Enable to show your Developer Tab. Go to Visual Basic and paste the following code. Select the 'Spin Shape' and go to Insert | Action | Run Macro... and select SpinDice. The dice will be randomised when the VBA Macro is run, which would occur when the 'Spin Button' is clicked.
				
					Dim Dice As Model3DFormat, xax As Integer, yax As Integer, zax As Integer

Sub SpinDice()
For i = 1 To 2 'change to '1 To 1' if only once dice
Set Dice = ActivePresentation.SlideShowWindow.View.Slide.Shapes("dice" & i).Model3D
Randomize
R = Int((6 * Rnd) + 1)
If R = 1 Then p1
If R = 2 Then p2
If R = 3 Then p3
If R = 4 Then s1
If R = 5 Then s2
If R = 6 Then s3
AdjustCoords
Next i
End Sub

Sub AdjustCoords()
Dice.RotationX = xax
Dice.RotationY = yax
Dice.RotationZ = zax
End Sub

Sub p1()
xax = Int((30 * Rnd) + 73)
yax = Int((10 * Rnd) + 349)
zax = Int((50 * Rnd) + 64)
End Sub

Sub p2()
xax = Int((30 * Rnd) + 250)
yax = Int((10 * Rnd) + 349)
zax = Int((50 * Rnd) + 270)
End Sub

Sub p3()
xax = Int((30 * Rnd) + 160)
yax = Int((10 * Rnd) + 349)
zax = Int((50 * Rnd) + 170)
End Sub

Sub s1()
xax = Int((30 * Rnd) + 190)
yax = Int((20 * Rnd) + 280)
zax = Int((50 * Rnd) + 314)
End Sub

Sub s2()
xax = Int((30 * Rnd) + 130)
yax = Int((20 * Rnd) + 70)
zax = Int((50 * Rnd) + 150)
End Sub

Sub s3()
xax = Int((30 * Rnd) + 0)
yax = Int((20 * Rnd) + 0)
zax = Int((20 * Rnd) + 0)
End Sub
				
			

How to make Random Dice in PowerPoint?

Shuffle Dice in PowerPoint Randomise - How To Make A Random Rolling Dice Animation In PowerPoint Using 3D Objects & VBA

If you do not have a version of PowerPoint that supports 3D Models, you can insert the six faces of the dice as an image and overlap them on top of each other. Name the images as ‘a1’ to ‘a6’ and ‘b1’ to ‘b6’ in case you have two dice. The dice face images can be downloaded from here or you can get the entire PowerPoint Template for free too!

Using the following VBA Code, we will hide all the  faces and then show any one random face. You can delete the highlighted lines in case you have only one dice.

				
					Sub ShuffleDice()
Randomize

r1 = Int(Rnd * 6) + 1 'generate random numbers
r2 = Int(Rnd * 6) + 1

For i = 1 To 6 'hide all 12 images
ActivePresentation.SlideShowWindow.View.Slide.Shapes("a" & i).Visible = msoFalse
ActivePresentation.SlideShowWindow.View.Slide.Shapes("b" & i).Visible = msoFalse
Next i

'show any 2 images
ActivePresentation.SlideShowWindow.View.Slide.Shapes("a" & r1).Visible = msoCTrue
ActivePresentation.SlideShowWindow.View.Slide.Shapes("b" & r2).Visible = msoCTrue
End Sub

				
			

Using Microsoft PowerPoint, we can create a lot of fascinating and interactive games and solutions for classrooms. Here is a video tutorial on making a random dice generator simulation:

Download Random Dice (Rolling Animation) PowerPoint Template For Free

🤝 Free Template

Randomised 3D Dice + Spin Animation

🌞 Free Template

2D Random Dice Simulator in PowerPoint

Animated Shuffle Dice in PowerPoint Randomise Free Download - How To Make A Random Rolling Dice Animation In PowerPoint Using 3D Objects & VBA