只需在其他地方回答它也可以这样做,您只需下载此文件
http://www.officeoneonline.com/eventgen/EventGen20.zip
安装它 创建一个类模块 粘贴此代码 Option Explicit
Public WithEvents PPTEvent As Application
Private Sub Class_Initialize()
End Sub
Private Sub PPTEvent_WindowSelectionChange(ByVal Sel As Selection)
If Sel.Type = ppSelectionShapes Then
If Sel.ShapeRange.HasTextFrame Then
If Sel.ShapeRange.TextFrame.HasText Then
If Trim(Sel.ShapeRange.TextFrame.TextRange.Text) = "Text inside your shape" Then
Sel.Unselect
yoursub
End If
End If
End If
End If
结束子
插入一个新模块粘贴此代码
将 cPPTObject 调暗为新的 Class1
将 TrapFlag 暗淡为布尔值
Sub TrapEvents()
If TrapFlag = True Then
MsgBox "Already Working"
Exit Sub
End If
Set cPPTObject.PPTEvent = Application
TrapFlag = True
End Sub
Sub ReleaseTrap()
If TrapFlag = True Then
Set cPPTObject.PPTEvent = Nothing
Set cPPTObject = Nothing
TrapFlag = False
End If
End Sub
Sub yoursub()
MsgBox "Your Sub is working"
End Sub
现在运行 TrapEvents,只要您单击带有该文本的形状,您的子程序就会运行 Credits to the person who write this http://www.officeoneonline.com/eventgen/eventgen.html