|
撸了几种PPT抽奖的方法
1是在每页PPT上写好名字,然后循环播放
2是用VBA,本例是利用VBA进行抽奖
- 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, arr1(1 To 5), sr$
- Set d = CreateObject("scripting.dictionary")
-
- If doTag = "start" Then
- arrRM = Split(Slide2.Shapes("文本框 2").TextEffect.Text, "、", -1, 1) '如果有需要你可以替换这里的空格,改为你需要的分隔符: 如个为英文分号 Split(Me.TextBox1, ";", -1, 1)
- F = 0
- Do While True
- sr = ""
- For x = 1 To 5
- 100:
- num = Int(((UBound(arrRM) - 0) + 1) * Rnd()) + 0
- If d.exists(num) Then
- GoTo 100
- Else
- d(num) = ""
- arr1(x) = arrRM(num)
- End If
- Next x
- d.RemoveAll
- 'I = Int(((UBound(arrRM) + 1) * Rnd) + 0)
- For x = 1 To 5
- sr = sr & arr1(x) & Chr(10)
- Next
- Slide2.Shapes("文本框 1").TextEffect.Text = sr
- If F = 1 Then Exit Do
- DoEvents
- Loop
- sr = ""
- 'TextBox1.Text = Replace(TextBox1.Text, TextBox2.Text, "") '删除已经被抽取的名单,不在重复抽取
- 'TextBox1.Text = Replace(TextBox1.Text, " ", " ")
- Else
- F = 1
- End If
- End Sub
复制代码
|
|