FracinDean
Board Regular
- Joined
- Jul 11, 2011
- Messages
- 110
- Office Version
- 365
- Platform
- Windows
I'm trying to use the wait function to make a picture rotate slowly. When I run the code, the macro pauses unexpectedly until I hit the "Esc" key, and then after that, it runs as expected. Any ideas how to avoid the initial unexpected pause? Code below, and thank you for taking a look.
VBA Code:
Dim i As Integer, delay As Double, waitTime As Double
ActiveSheet.Shapes.Range(Array("Picture 4")).Select
For i = 1 To 12
Selection.ShapeRange.ThreeD.RotationZ = -i * 30
delay = 0.002 'in seconds
waitTime = TimeSerial(Hour(Now()), Minute(Now()), Second(Now()) + delay)
Application.Wait waitTime
Next i