ppt随机中奖或点名程序

成品界面
Private Declare Sub Sleep Lib “kernel32” (ByVal dwMilliseconds As Long)
Dim arrRM, F

Private Sub CommandButton1_BeforeDropOrPaste(ByVal Cancel As MSForms.ReturnBoolean, ByVal Action As MSForms.fmAction, ByVal Data As MSForms.DataObject, ByVal X As Single, ByVal Y As Single, ByVal Effect As MSForms.ReturnEffect, ByVal Shift As Integer)

End Sub

'输入名单到: TextBox1 采用单个空格分隔,最前和最后一个数据后不要留空格(否则可能部分元素抽出为空)
'代码注释部分用于调试,或者你可以修改为其他用途,比如可以显示给用户观看。
Private Sub CommandButton1_Click()
If Me.CommandButton1.Caption = “停” Then
Me.CommandButton1.Caption = “开始”
Call CQ_do(“stop”)
Else
Me.CommandButton1.Caption = “停”
Call CQ_do(“start”)
End If
End Sub

Private Sub CQ_do(doTag)
Dim I
If doTag = “start” Then
arrRM = Split(Me.TextBox1, " ", -1, 1) '如果有需要你可以替换这里的空格,改为你需要的分隔符: 如个为英文分号 Split(Me.TextBox1, “;”, -1, 1)
’ TextBox3 = “”
’ TextBox3.Visible = True
’ TextBox4.Visible = True
’ Me.TextBox4 = UBound(arrRM) & " " & arrRM(0) & " " & arrRM(UBound(arrRM))
F = 0
Do While True
Sleep 30
I = Int(((UBound(arrRM) + 1) * Rnd) + 0)
’ TextBox3 = TextBox3 & “-” & I
TextBox2.Text = arrRM(I)
If F = 1 Then Exit Do
DoEvents
Loop
Else
F = 1
End If
End Sub

Private Sub CommandButton1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)

End Sub

Private Sub CommandButton1_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)

End Sub

Private Sub TextBox1_Change()

End Sub

Private Sub TextBox2_Change()

End Sub
VBA界面图

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

想做个高级码农

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值