A verb is an action undertaken by an OLE
object to activate it's contents. Examples of various verbs are 'Open',
'Edit', 'Play' etc. You can list out the verbs associated with an OLE
object using the items in the ObjectVerbs collection. Whenever an
OLE object is double-clicked the default verb - the first verb in the
collection gets performed. In case of MS Graph objects this verb is the
'Edit' verb. This opens up a window within the parent application -
PowerPoint in this specific case. However there maybe instance when you
need to open up the graph in a separate window of it's own. In that case
you need to activate the 'Open' verb. Code snippet below illustrates the
same. DoVerb is the method used to activate a particular verb of the OLE
object. It accepts the index value of the verb within the ObjectVerbs
collection and performs the associated verb. If no argument is passed it
defaults to 1. In this example, we pass 2 which is the index value of
the 'Open' verb.
Top
'
--------------------------------------------------------------------------------
' Copyright ©1999-2007, Shyam Pillai, All Rights Reserved.
'
--------------------------------------------------------------------------------
' You are free to use this code within your own applications, add-ins,
' documents etc but you are expressly forbidden from selling or
' otherwise distributing this source code without prior consent.
' This includes both posting free demo projects made from this
' code as well as reproducing the code in text or html format.
'
--------------------------------------------------------------------------------
Sub ListVerbs()
Dim oVerb As Variant
' Assuming that the 2nd shape on the slide is an OLE object
With ActivePresentation.Slides(1).Shapes(2).OLEFormat
For Each oVerb In .ObjectVerbs
Debug.Print oVerb
Next
End With
End Sub
Sub OpenInWindow()
' Assuming that the 2nd shape on the slide is an MS Graph object
With ActivePresentation.Slides(1).Shapes(2).OLEFormat
.DoVerb 2 ' Open Verb
End With
End Sub
Top
|