吾爱破解 - 52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 2248|回复: 18
收起左侧

[其他原创] PPT抽签

  [复制链接]
hzxszxd 发表于 2025-3-3 21:06
闲来无事,再来一个PPT抽签,也算应了坛友要求
代码如下:
[Visual Basic] 纯文本查看 复制代码
Dim usedItems As New CollectionDim allnumber, usernumber As Integer

Sub DrawLottery()
    On Error Resume Next
    usernumber = usedItems.Count
    allnumber = ActivePresentation.Slides("Slide2").Shapes("NameList").TextFrame.TextRange.Lines.Count
    If allnumber <= usernumber Then
        MsgBox "所有人已抽完!"
        Exit Sub
    End If
    
    Randomize
    Do
        randLine = Int(Rnd() * ActivePresentation.Slides("Slide2").Shapes("NameList").TextFrame.TextRange.Lines.Count) + 1
        currentItem = ActivePresentation.Slides("Slide2").Shapes("NameList").TextFrame.TextRange.Lines(randLine).Text
    Loop Until Not InCollection(usedItems, currentItem)
    
    usedItems.Add currentItem
    ActivePresentation.Slides("Slide2").Shapes("ResultBox").TextFrame.TextRange.Text = currentItem
End Sub

Function InCollection(col As Collection, ByVal val As String) As Boolean
    Dim item
    For Each item In col
        If item = val Then
            InCollection = True
            Exit Function
        End If
    Next
End Function

Sub ResetDraw()
    ActivePresentation.Slides("Slide2").Shapes("ResultBox").TextFrame.TextRange.Text = " "
    Set usedItems = Nothing
End Sub


抽签2.rar (32.41 KB, 下载次数: 209)




免费评分

参与人数 2吾爱币 +6 热心值 +2 收起 理由
苏紫方璇 + 5 + 1 欢迎分析讨论交流,吾爱破解论坛有你更精彩!
arctan1 + 1 + 1 热心回复!

查看全部评分

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

gaoxiaoao 发表于 2025-3-4 07:42
感谢楼主分享
shiqiang 发表于 2025-3-4 08:18
arctan1 发表于 2025-3-4 08:21
vinllar 发表于 2025-3-4 08:37
感谢分享,之前找的抽签杀毒软件都报错。。。。。希望这个好用。。
惠夏柳 发表于 2025-3-4 09:10
下载试用一下先
vickwu2023 发表于 2025-3-4 09:35
这个好,感谢楼主分享。
cai2532 发表于 2025-3-4 10:19
希望这个比较实用。
 楼主| hzxszxd 发表于 2025-3-4 12:24
shiqiang 发表于 2025-3-4 08:18
这个PPT抽签怎么用?

打开后,右边有一个文本框,抽签的内容粘贴在里面即可
shiqiang 发表于 2025-3-4 14:55
hzxszxd 发表于 2025-3-4 12:24
打开后,右边有一个文本框,抽签的内容粘贴在里面即可

谢谢指导!
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

返回列表

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - 52pojie.cn ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2026-3-27 11:08

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表