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 OfficeMicrosoft PowerPointVBA
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="">
		<!-- Repurpose built in button, toggleButton or checkBox controls -->
		<command idMso="Paste" onAction="OnAction"/>
		<command idMso="PasteSourceFormatting" onAction="OnAction"/>
		<command idMso="PasteDestinationTheme" onAction="OnAction"/>

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

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:


Why isn't this working?
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 8 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 8 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros