是否有可能触发事件。在宏∀VBA模块运行之前保存文档?
发布于 2022-10-14 08:29:48
如果您的问题是“如何在保存演示文稿之前触发事件”,则答案如下。这是一个多步骤的过程。
Dim WithEvents ppApp As PowerPoint.Application
Sub Initialise()
Set ppApp = PowerPoint.Application
End Sub
Private Sub ppApp_PresentationBeforeSave(ByVal Pres As Presentation, Cancel As Boolean)
MsgBox "Before save for " & Pres.Name
End Subhttps://stackoverflow.com/a/38295674/11318818:
在放置Dim mEvents As CEvents过程的标准模块中添加模块级声明:Dim mEvents As CEvents
MyOnloadProcedure()过程中,将MsgBox "Hello"替换为:Set mEvents = New CEvents
mEvents.Initialise请注意,一旦您对VBA代码进行模块级编辑,PresentationBeforeSave事件将停止触发,直到您关闭并重新打开演示文稿.这是因为模块级变量在进行此类编辑时处于松散状态,然后在重新打开演示文稿时重新设置状态。
https://stackoverflow.com/questions/74064630
复制相似问题