M
MAX
All I want is that is that when I open the file, the animation starts. I have
these codes:
This code is in the Workbook:
Private Sub Workbook_Open()
Sheets("Sheet1").Activate
Call StartDemo1
End Sub
Sub StartDemo1()
On Error Resume Next
Set OldCell = ActiveCell
ActiveSheet.Shapes("Picture 1").Select
For i = 0 To 360 Step 5
Wait (0.08)
Selection.ShapeRange.IncrementRotation 15
Selection.ShapeRange.Left = Selection.ShapeRange.Left + 10
Selection.ShapeRange.Top = Selection.ShapeRange.Top - 0.1
DoEvents
Next i
For i = 360 To 0 Step -10.5
Wait (0.1)
Selection.ShapeRange.IncrementRotation -15
Selection.ShapeRange.Left = Selection.ShapeRange.Left - 20
Selection.ShapeRange.Top = Selection.ShapeRange.Top + 0.1
DoEvents
Next i
Selection.ShapeRange.Top = 300
Selection.ShapeRange.Left = 42
OldCell.Select
End Sub
and I have this code in the Workbook Module:
Sub Wait(DelaySecs As Single)
Dim sngSec As Single
EndDelay = Timer + DelaySecs
Do While Timer < EndDelay
DoEvents
Loop
End Sub
Why I have to run from Macro to start the animation?
Just to tell you that the name of Sheet 1 is Demo1.
Thanks.
these codes:
This code is in the Workbook:
Private Sub Workbook_Open()
Sheets("Sheet1").Activate
Call StartDemo1
End Sub
Sub StartDemo1()
On Error Resume Next
Set OldCell = ActiveCell
ActiveSheet.Shapes("Picture 1").Select
For i = 0 To 360 Step 5
Wait (0.08)
Selection.ShapeRange.IncrementRotation 15
Selection.ShapeRange.Left = Selection.ShapeRange.Left + 10
Selection.ShapeRange.Top = Selection.ShapeRange.Top - 0.1
DoEvents
Next i
For i = 360 To 0 Step -10.5
Wait (0.1)
Selection.ShapeRange.IncrementRotation -15
Selection.ShapeRange.Left = Selection.ShapeRange.Left - 20
Selection.ShapeRange.Top = Selection.ShapeRange.Top + 0.1
DoEvents
Next i
Selection.ShapeRange.Top = 300
Selection.ShapeRange.Left = 42
OldCell.Select
End Sub
and I have this code in the Workbook Module:
Sub Wait(DelaySecs As Single)
Dim sngSec As Single
EndDelay = Timer + DelaySecs
Do While Timer < EndDelay
DoEvents
Loop
End Sub
Why I have to run from Macro to start the animation?
Just to tell you that the name of Sheet 1 is Demo1.
Thanks.