This is the most straight forward way to do it. There are more elegant ways
You don't use the add commandbar logic. Use the CustomUI editor ....
http://openxmldeveloper.org/blog/b/o...8/06/7293.aspx
http://openxmldeveloper.org/cfs-file...ditorSetup.zip
....to add this to your XLSM or PPTM.
Once there save it as the appropriate addin (i.e. PPAM)
You can use built in icons, add your own, or not use any. I just used ABCD because it's easy
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui" onLoad="cbOnRibbonLoad" > <ribbon> <tabs> <!-- Add Custom group to the Home tab in the ribbon --> <tab id="myTab" label="My Tab"> <group id="myGroup" label="My Addin"> <box id="box4" boxStyle="vertical"> <button id="bCopyPosition" label="Copy Pos" onAction = "cbCopyPositionSize" imageMso="A"/> <button id="bPastePosition" label="Paste Pos" onAction = "cbPastePositionSize" imageMso="B"/> <button id="bBreakLinks" label="Break Links" onAction = "cbBreakAllLinks" imageMso="C"/> <button id="bBrealLinksEmail" label="Break Email" onAction = "cbBreakAllLinksAndEmail" imageMso="D"/> </box> </group> </tab> </tabs> </ribbon> </customUI>
The callbacks (i.e. what the button calls) look like these
Option Explicit Public oRibbon As IRibbonUI 'Callback for customUI.onLoad Sub cbOnRibbonLoad(ribbon As IRibbonUI) Set oRibbon = ribbon End Sub 'Callback for bCopyPosition onAction Sub cbCopyPositionSize(control As IRibbonControl) CopyPositionSize End Sub 'Callback for bPastePosition onAction Sub cbPastePositionSize(control As IRibbonControl) PastePositionSize End Sub 'Callback for bBreakLinks onAction Sub cbBreakAllLinks(control As IRibbonControl) BreakAllLinks End Sub 'Callback for bBrealLinksEmail Sub cbBreakAllLinksAndEmail(control As IRibbonControl) BreakAllLinksAndEmail End Sub
Each button call back then calls your 'real' macro. These are just stubs
Option Explicit Sub CopyPositionSize() MsgBox "CopyPositionSize" End Sub Sub PastePositionSize() MsgBox "PastePositionSize" End Sub Sub BreakAllLinks() MsgBox "BreakAllLinks" End Sub Sub BreakAllLinksAndEmail() MsgBox "BreakAllLinksAndEmail" End Sub
Look through the threads in this forum for ideas, and there are many 'how to' references on the web
Capture.JPG
This is for Excel because that's what I had handy (the process is the same), but John was also kind enough to add more references and a PP addin example to the original thread
http://www.vbaexpress.com/forum/show...range-vertical!




