求助,想把随机抽取的图片交替在图片框1和图片框2中显示,每秒交替一次,一定时间后终止,退出程序,

roserice roserice 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
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
...全文

相关推荐

评论 8
收藏 已收藏
分享
返回顶部
roserice
VBA 2,506 成员 10,830 内容