Home  >  Article  >  Software Tutorial  >  What’s wrong with the PPT countdown VBA code?

What’s wrong with the PPT countdown VBA code?

PHPz
PHPzforward
2024-01-07 21:02:081286browse

What’s wrong with the PPT countdown VBA code

Changed in two places

The first line has been changed for you

In order to help players who have not passed the level yet, let us learn about the specific puzzle solving methods. In addition, another little trick is to add a shape(1) after ActivePresentation.Slides(1). This operation can help you solve the puzzle faster, so remember to try it.

Test possible

In order to help players who have not passed the level yet, let us learn about the specific puzzle solving methods. At the same time, we can use the SetTimer function to set the timer, which is located in the user32 library. This function accepts four parameters: window handle (hwnd), timer ID (nIDEvent), interval time (uElapse) and timer callback function (lpTimerFunc). By calling this function, we can perform specific operations within a certain time interval.

Sub Timer()

To help players solve the problem, we can use the following code to calculate the difference in seconds between the current time and the specified date: `ss = DateDiff("s", Now, "2012-3-22 00:00:00 ")`. This code will return an integer value representing the number of seconds between the current time and the specified date.

dd = ss \ 86400

hh = (ss Mod 86400) \ 3600

mm = (ss Mod 3600) \ 60

ss = ss Mod 60

ActivePresentation.Slides(1).Shapes(1).TextFrame.TextRange.Text = "There are still days before the 2012 exam" & vbCrLf & dd & "days" & hh & "hours" & mm & "minutes" & ss & "second"

End Sub

Sub Start()

ActivePresentation.SlideShowSettings.Run

SetTimer 0, 0, 1000, AddressOf Timer

End Sub

How to set the countdown time on PPT

1. Open PPT, select "Insert" - "Shape" - "Circle" (hold down the shift key while drawing a circle).

PPT倒数计时 VBA代码哪里错了

2. Set the fill background color and border of the drawn circle (select the circle, right-click and select "Format Shape", or directly use the "Fill" and "Outline" functions to set it.), and then fill in the circle number.

PPT倒数计时 VBA代码哪里错了

PPT倒数计时 VBA代码哪里错了

3. Set animation, select the drawn shape (combine circles and numbers) - select animation - add animation - select the entry animation as "appear" - select the exit animation as "disappear". Then set the "Start" option to "After Previous Animation" and the delay time to 0.5 seconds.

PPT倒数计时 VBA代码哪里错了

PPT倒数计时 VBA代码哪里错了

4. Then copy the drawn shape, paste 4 identical circles (their animation properties are also copied and pasted at the same time), and change the numbers in the circles to 4, 3, 2, and 1.

PPT倒数计时 VBA代码哪里错了

5. Set the format of five numbers. Select the five shapes and select "Center Left and Right" and "Center Top and Bottom" under "Format" - "Alignment".

PPT倒数计时 VBA代码哪里错了

6. After completing the above steps, the five shapes are "combined into one", and then select the play button to view the dynamic countdown effect from 5-1.

PPT倒数计时 VBA代码哪里错了

The above is the detailed content of What’s wrong with the PPT countdown VBA code?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:docexcel.net. If there is any infringement, please contact admin@php.cn delete