找回密码
 立即注册
搜索

令 PPT 自動執行

3
回复
270
查看
[复制链接]

7

主题

190

帖子

18

幻币

一流武者

Rank: 3Rank: 3

积分
220
QQ
2016-4-12 12:16:21 显示全部楼层 |阅读模式
Code That Runs AutomaticallySome Office applications have a way to run VBA code automatically when the user opens a document; not PowerPoint.
Details : Please read
PPT学习论坛
回复

使用道具 举报

11

主题

215

帖子

32

幻币

一流武者

Rank: 3Rank: 3

积分
252
QQ
2016-4-12 13:52:25 显示全部楼层
班竹,还是请您讲汉语,看起来太累了。
PPT学习论坛
回复 支持 反对

使用道具 举报

11

主题

229

帖子

34

幻币

一流武者

Rank: 3Rank: 3

积分
276
QQ
2016-4-12 14:31:18 显示全部楼层
用英文發表是因為原文是英文啊
如看不明上文或不可了解的話可以不造訪,主要是以下的編碼。
首先放在 Module ,修改適合你的用途後儲存為 PPT。再將 PPT 儲存為 PPA 就可以。
Start a new PowerPoint file. Press ALT+F11 to start the VB Editor. Choose Insert, New Module.Add this code to the new module:
Sub Auto_Open()    Dim oToolbar As CommandBar    Dim oButton As CommandBarButton    Dim MyToolbar As String    ' Give the toolbar a name    MyToolbar = "Kewl Tools"    On Error Resume Next    ' so that it doesn't stop on the next line if the toolbar's already there    ' Create the toolbar; PowerPoint will error if it already exists    Set oToolbar = CommandBars.Add(Name:=MyToolbar, Position:=msoBarFloating, Temporary:=True)    If Err.Number <> 0 Then  ' The toolbar's already there, so we have nothing to do          Exit Sub    End If    On Error GoTo ErrorHandler    ' Now add a button to the new toolbar    Set oButton = oToolbar.Controls.Add(Type:=msoControlButton)    ' And set some of the button's properties    With oButton         .DescriptionText = "This is my first button"   'Tooltip text when mouse if placed over button         .Caption = "Button1"    'Text if Text in Icon is chosen         .OnAction = "Button1"  'Runs the Sub Button1() code when clicked         .Style = msoButtonIcon    ' Button displays as icon, not text or both         .FaceId = 52       '52 is my favorite pig; chooses icon #52 from the available Office icons    End With    ' Repeat the above for as many more buttons as you need to add    ' Be sure to change the .OnAction property at least for each new button    ' You can set the toolbar position and visibility here if you like    ' By default, it'll be visible when created    oToolbar.Top = 150    oToolbar.Left = 150    oToolbar.Visible = TrueNormalExit:    Exit Sub   ' so it doesn't go on to run the errorhandler codeErrorHandler:     'Just in case there is an error     MsgBox Err.Number & vbCrLf & Err.Description     Resume NormalExit:End SubSub Button1()' This code will run when you click Button 1 added above' Add a similar subroutine for each additional button you create on the toolbar    ' This is just some silly example code.  You'd put your real working code here to do whatever    ' it is that you want to do    MsgBox "Will you PLEASE stop clicking me?  I have a headache already!"End Sub
' That's it. Don't add anything past this point to your code.
PPT学习论坛
回复 支持 反对

使用道具 举报

14

主题

234

帖子

49

幻币

一流武者

Rank: 3Rank: 3

积分
311
QQ
2016-4-12 15:26:53 显示全部楼层
可行,谢谢楼主
PPT学习论坛
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册