Private Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As LongPtr)
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Sub test75_1()
Dim ws As Worksheet
Set ws = Sheets("Sheet1")
ws.Shapes.AddShape msoShapeOval, 0, 200, 30, 30
ws.Shapes(ws.Shapes.Count).name = "maru"
End Sub
Sub test75_2()
Dim ws As Worksheet
Dim i As Integer
Set ws = Sheets("Sheet1")
ws.Shapes.AddShape msoShapeOval, 0, 200, 30, 30
ws.Shapes(ws.Shapes.Count).name = "maru"
For i = 0 To 200
ws.Shapes(1).Left = i * 3
Sleep 10
DoEvents
Next i
ws.Shapes("maru").Delete
End Sub
Sub test75_3()
Dim ws As Worksheet
Dim i As Integer
Dim x As Integer
Set ws = Sheets("Sheet1")
ws.Shapes.AddShape msoShapeOval, 0, 200, 30, 30
ws.Shapes(ws.Shapes.Count).name = "maru"
i = 1
Do While True
If x > 600 Then
i = -3
ElseIf x < 3 Then
i = 3
End If
x = x + i
ws.Shapes(1).Left = x
Sleep 10
DoEvents
Loop
End Sub
Sub test75_4()
Dim ws As Worksheet
Dim i As Integer
Dim x As Integer
Set ws = Sheets("Sheet1")
ws.Shapes.AddShape msoShapeOval, 0, 150, 30, 30
ws.Shapes(ws.Shapes.Count).name = "maru"
ws.Shapes.AddShape msoShapeOval, 0, 200, 30, 30
ws.Shapes(ws.Shapes.Count).name = "maru2"
ws.Shapes.AddShape msoShapeOval, 0, 250, 30, 30
ws.Shapes(ws.Shapes.Count).name = "maru3"
i = 1
Do While True
If x > 600 Then
i = -3
ElseIf x < 3 Then
i = 3
End If
x = x + i
ws.Shapes(1).Left = x
ws.Shapes(2).Left = x * 0.7
ws.Shapes(3).Left = x * 0.5
Sleep 10
DoEvents
Loop
End Sub