troubleshooting Question

Using VBA to repurpose built-in Microsoft PowerPoint controls for Paste, paste With Source Formatting and paste Using Destination Theme

Avatar of Jamie Garroch (MVP)
Jamie Garroch (MVP)Flag for United Kingdom of Great Britain and Northern Ireland asked on
Microsoft OfficeVBAMicrosoft PowerPoint
8 Comments1 Solution112 ViewsLast Modified:
The Office fluent UI supports repurposing of button, toggleButton and checkBox controls.

I want to repuropse the following three paste commands in PowerPoint which are all defined as button controls in the Microsoft documentation:

Paste, PasteSourceFormatting, PasteDestinationTheme

Here is the resulting customUI:

<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">
	<commands>
		<!-- Repurpose built in button, toggleButton or checkBox controls -->
		<command idMso="Paste" onAction="OnAction"/>
		<command idMso="PasteSourceFormatting" onAction="OnAction"/>
		<command idMso="PasteDestinationTheme" onAction="OnAction"/>
	</commands>
</customUI>

Open in new window


And here is a simple VBA callback procedure to determine which button was pressed:

Sub OnAction(control As IRibbonControl, ByRef cancelDefault)
    Debug.Print control.Id
    cancelDefault = False
End Sub

Open in new window


If I now copy a slide in PowerPoint and paste it using Ctrl+V I see the debug output for "Paste".

If I then use the Paste drop down menu in the Home tab to use either of the other two commands I don't see any debug output nor error so it seems these controls are not being repurposed.

This digitally signed project file includes the above example:

repurposing-paste-commands.pptm

Why isn't this working?
ASKER CERTIFIED SOLUTION
John Korchok
Production Manager
Log in to continue reading
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform for $9.99/mo
View membership options
Unlock 1 Answer and 8 Comments.
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
The Value of Experts Exchange in My Daily IT Life

Experts Exchange (EE) has become my company's go-to resource to get answers. I've used EE to make decisions, solve problems and even save customers. OutagesIO has been a challenging project and... Keep reading >>

Mike

Owner of Outages.IO
Phoenix, Arizona, United States
Member Since 2016
Join a full scale community that combines the best parts of other tools into one platform.
Unlock 1 Answer and 8 Comments.
View membership options
“All of life is about relationships, and EE has made a virtual community a real community. It lifts everyone's boat.”
William Peck

Member since 2004