简单示例,你需要再扩展
Option Explicit
Dim bM As Boolean
Private Sub Command1_Click()
bM = Not bM
Call MoveFrm
End Sub
Sub MoveFrm()
Dim iM As Long
iM = 100
Do While bM
With Me
.Left = .Left + iM
If .Left <= 0 Or (.Left + .Width) > Screen.Width Then iM = iM * -1
End With
DoEvents
Loop
End Sub