Somewhat Frivolous Graphics Question


Posted by John L. on February 02, 2001 7:35 AM

I want to make a graphical object rotate 360 degrees, but do it slowly, so that
it appears to be "animated"

I wrote a simple program to do this, but I need help with the area below
that is marked with three asterisks

I am trying to rotate the object 1 degree, pause, then rotate 1 degree and so on.

Here it is………
For RotateVariable = 1 to 360
ActiveSheet.Shapes("Object").Rotation = RotateVariable
' ' ' Some command(s) that would cause the program to pause for perhaps 1/2 a second
Next RotateVariable

I tried putting in a simple loop like:
For Delay = 1 to 10000
Next Delay
But, this does not work the program simply pauses then does the the full 360 degree
rotation. At least that is how it appears to the "naked eye."



Posted by Faster on February 02, 2001 9:17 AM

'Try this
Sub TimeWait()
Dim NewHour
Dim NewMinute
Dim NewSecond
Dim WaitTime
Dim i
For i = 1 To 360
NewHour = Hour(Now())
NewMinute = Minute(Now())
NewSecond = Second(Now()) + 1
WaitTime = TimeSerial(NewHour, NewMinute, NewSecond)
Range("D1") = NewSecond
ActiveSheet.Shapes("Object").Rotation = i
Application.Wait WaitTime
Next i
End Sub