Exit Function End If Next End Function 代码解析: 第3~8行代码使用For语句循环遍历所有Presentation对象。 第4行代码判断Presentation对象的Name属性是否为指定值,如果满足条件,第5行代码将对象引用作为返回值,第6行代码结束程序执行。 使用起来也非常简单: Subdemo()Dim objPre As PresentationSetobjPre=ThisPresent...
If p.Name = "MyTools.ppam" Then Set ThisPresentation = p Exit Function End If Next End Function 1 2 3 4 5 6 7 8 9 代码解析: 第3~8行代码使用For语句循环遍历所有Presentation对象。 第4行代码判断Presentation对象的Name属性是否为指定值,如果满足条件,第5行代码将对象引用作为返回值,第6行代码...
想使用VBA直接调用Python脚本 Python脚本如下: import time def hello(name): return "Hello, " + ...
Presentations.Open FileName:="c:\My Documents\MyPres.ppt", _ReadOnly:=msoFalse, WithWindow:=msoTrueWithActivePresentationIf.VBASigned = msoFalseAnd_ .VBProject.VBComponents.Count >0ThenMsgBox"Warning! The Visual Basic project for"_ & vbCrLf &"this presentation has not"_ & vbCrLf &" been digit...
Set ppt = Presentations.Open("My Presentation.pptx") 引用活动演示文稿 当VBA代码被执行时,使用ActivePrentation来操作GUI中的当前的演示文稿对象。 '将ActivePresentation的名称打印到即时窗口中。 Debug.Print ActivePresentation.Name 保存当前演示文稿 下面的语句将保存活动演示文稿,如果它之前已经保存了,那么下面的语...
Sub CheckOutPresentation(strPresentation As String) Dim strFileName As String With Presentations If .CanCheckOut(strPresentation) = True Then .CheckOut FileName:=strPresentation .Open FileName:=strFileName Else MsgBox "You are unable to check out this " & _ "presentation at this time." End...
create PowerPoint presentations. All Excel users usually spend a considerable amount of time preparing the presentation from Excel data and reports. If you spend considerable time preparing PowerPoint presentations, this tutorial will show you how to create a PowerPoint presentation from Excelusing VBA ...
用VBA去操作PowerPoint 1. 获取当前Presenation的名字 Sub NameThisPres() MsgBox Windows(1).Presentation.Name End Sub 2. 显示当前Presentation上所有的Placeholder. Sub EachObject() Dim oshapes As Object Dim ph As Object Dim Oslide As Object With ActiveWindow.Selection.SlideRange.Shapes Set Oslide =...
Powerpoint中VBA编程技巧 .Application 对象 该对象代表 PowerPoint 应用程序,通过该对象可访问 PowerPoint 中的其他所有对象。 (1)Active 属性:返回指定窗格是否被激活。 (2)ActivePresentation 属性:返回 Presentation 对象,代表活动窗口中打开的演示文稿。 (3)ActiveWindow 属性:返回 DocumentWindow 对象,代表当前文档...
Presentation ObjectSupport and feedbackHave questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.Feedback Was this page helpful? Yes No ...