Dim g As Boolean
Dim x As Long
Private Sub Command1_Click()
Timer1.Enabled = True
End Sub
Private Sub Form_Load()
g = True
x = Shape1.Left
End Sub
Private Sub Timer1_Timer()
If g Then
x = x - 300
Else
x = x + 300
End If
If x < 0 Or x > (Me.ScaleWidth - Shape1.Width) Then
g = Not g
End If
Shape1.Move x
End Sub