求助,想把随机抽取的图片交替在图片框1和图片框2中显示,每秒交替一次,一定时间后终止,退出程序,
Private Sub UserForm_Initialize()
If Cells(1, 1) <> 0 Then Cells(1, 1) = 0
UserForm1.Image2.Enabled = False
UserForm1.Image2.Visible = False
Call aa
End Sub
Private Sub CommandButton1_Click()
Application.OnTime Now + TimeValue("00:00:01"), "aa", schedule:=False
End Sub
Sub aa()
Application.OnTime Now + TimeValue("00:00:01"), "aa", schedule:=True
Cells(1, 1) = Cells(1, 1) + 1
If Cells(1, 1) > 5 Then UserForm1.Image1.Visible = False
If Cells(1, 1) > 5 Then UserForm1.Image2.Visible = True
If Cells(1, 1) > 10 Then Application.OnTime Now + TimeValue("00:00:01"), "aa", schedule:=False
With UserForm1.Image2
.Picture = LoadPicture("d:\" & Int(11 * Rnd + 1) & ".jpg")
.Move 120, 10, 100, 100
.PictureSizeMode = fmPictureSizeModeStretch
End With
With UserForm1.Image1
.Picture = LoadPicture("d:\" & Int(11 * Rnd + 1) & ".jpg")
.Move 10, 10, 100, 100
.PictureSizeMode = fmPictureSizeModeStretch
End With
End Sub