Solved

I need to observe powerpoint actions in my OSX app

Posted on 2016-09-19
5
149 Views
Last Modified: 2016-09-20
I need to observe powerpoint actions in my OSX app.
Scenario: I need to perform some actions in my OSX application when user clicks on save button in PowerPoint. Is there any ways to to this. I have achieved this functionality in Windows application by VBA Macro Events, but in PowerPoint Mac version the VBA Macro Events are not supported.
Thanks in advance
Please help me
0
Comment
Question by:Irshad KA
  • 3
  • 2
5 Comments
 
LVL 11

Accepted Solution

by:
Jamie Garroch earned 500 total points
ID: 41806034
You cannot use application events in Office:mac as they aren't supported (yet).

But, there is a way to get around this limitation for specific use cases with PowerPoint:mac 2016 (tested with build 15.26.160910) using the Repurpose Commands method. This allows you to hook into a command within the UI, as long as it's represented by a simple button in the interface, which File Save is.

This is how to do it:

1. Download CustomUI Editor from here
2. Create a new PowerPoint file
3. Open the VBE (Alt+F11)
4. Paste this code into a standard module
Option Explicit

'Callback for customUI.onLoad
Public Sub onLoadRibbon(ribbon As IRibbonUI)
  ' Do anything required when the ribbon is loaded
  Debug.Print "Ribbon loaded"
End Sub

'Callback for Save onAction
Sub RepurposeSave(control As IRibbonControl, ByRef cancelDefault)
  ' Do things when the user clicks the save button or invokes a save event e.g. via ctrl+s
  Select Case MsgBox("About to save this presenation." & vbCrLf & vbCrLf & _
                     "Are you sure you want to continue?", vbQuestion + vbYesNo, "Save Presentation")
    Case vbYes
      cancelDefault = False ' allow the presentation to be saved
    Case vbNo
      cancelDefault = True
    Case Else
      cancelDefault = True
  End Select
End Sub

Open in new window

5. Save as a macro-enabled .pptm file
6. Close the PowerPoint file
7. Run the Custom UI Editor and insert an Office 2010 Custom UI Part
8. Paste this code into the XML code pane:
<customUI onLoad="onLoadRibbon" xmlns="http://schemas.microsoft.com/office/2009/07/customui">
	<commands>
		<command idMso="FileSave" onAction="RepurposeSave" />
	</commands>
</customUI>

Open in new window

9. Save the file
10. Reopen the file in PowerPoint:mac 2016
11. Accept to enable macros when asked:
PowerPoint:mac 2016 macro dialogue12. Click the save button to see this message:
PowerPoint:mac Save repurposed
The result is the attached file (I had to change the extension from .pptm to .zip to get EE to accept it):
Repurposing-Save-Command.zip
1
 

Author Comment

by:Irshad KA
ID: 41806234
Thanks Jamie for this wonderful solution, working perfectly in powerpoint 2016 mac version.
But it is not working in powerpoint 2011 mac version. Is there any possible way to achieve this functionality in powerpoint 2011 mac version.
0
 
LVL 11

Expert Comment

by:Jamie Garroch
ID: 41806305
The ribbon isn't extensible in Office:mac 2011 so no, there is no solution to detect the Save event in PowerPoint:mac 2011 as per this EE answer from a PowerPoint MVP:

https://www.experts-exchange.com/questions/28660552/VBA-application-events-or-equivalent-for-PowerPoint-mac-2011.html
1
 

Author Comment

by:Irshad KA
ID: 41806311
Thanks Jamie Garroch
0
 
LVL 11

Expert Comment

by:Jamie Garroch
ID: 41806345
You're welcome Irshad. If your happy with my response, please could you mark it as the answer?
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

We could spend the next millennium discussing the differences of the Mac and Windows platforms. The next century will continue to have fanatics on both side of the equation and neither side will win the war. However, that’s not why we are here. W…
Do you come here a lot? Are you lazy like me and don't want to go through the "trouble" of having to click your Dock's Safari icon and then having to click your Experts Exchange Favorites bookmark to get here? Well then this article is for you.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question