ExcelHome技术论坛

 找回密码
 免费注册

QQ登录

只需一步,快速开始

快捷登录

搜索
EH技术汇-专业的职场技能充电站 妙哉!函数段子手趣味讲函数 Excel服务器-会Excel,做管理系统 Excel Home精品图文教程库
HR薪酬管理数字化实战 Excel 2021函数公式学习大典 Excel数据透视表实战秘技 打造核心竞争力的职场宝典
300集Office 2010微视频教程 数据工作者的案头书 免费直播课集锦 ExcelHome出品 - VBA代码宝免费下载
用ChatGPT与VBA一键搞定Excel WPS表格从入门到精通 Excel VBA经典代码实践指南
查看: 1952|回复: 3

令 PPT 自動執行

[复制链接]

TA的精华主题

TA的得分主题

发表于 2005-5-29 00:20 | 显示全部楼层 |阅读模式
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用  · 内置多项VBA编程加强工具       ★ 免费下载 ★      ★使用手册

Code That Runs Automatically Some Office applications have a way to run VBA code automatically when the user opens a document; not PowerPoint.

Details : Please read Will VBA solve my presentation problem?

TA的精华主题

TA的得分主题

发表于 2005-5-29 12:10 | 显示全部楼层
班竹,还是请您讲汉语,看起来太累了。

TA的精华主题

TA的得分主题

 楼主| 发表于 2005-5-29 19:10 | 显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件       ★免费下载 ★       ★ 使用帮助

用英文發表是因為原文是英文啊 [em09]

如看不明上文或不可了解的話可以不造訪,主要是以下的編碼。

首先放在 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 = True NormalExit: Exit Sub ' so it doesn't go on to run the errorhandler code ErrorHandler: 'Just in case there is an error MsgBox Err.Number & vbCrLf & Err.Description Resume NormalExit: End Sub Sub 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.

TA的精华主题

TA的得分主题

发表于 2005-5-30 08:21 | 显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用  · 内置多项VBA编程加强工具       ★ 免费下载 ★      ★使用手册
可行,谢谢楼主
您需要登录后才可以回帖 登录 | 免费注册

本版积分规则

手机版|关于我们|联系我们|ExcelHome

GMT+8, 2024-6-4 01:39 , Processed in 0.035707 second(s), 12 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 1999-2023 Wooffice Inc.

沪公网安备 31011702000001号 沪ICP备11019229号-2

本论坛言论纯属发表者个人意见,任何违反国家相关法律的言论,本站将协助国家相关部门追究发言者责任!     本站特聘法律顾问:李志群律师

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