How to start a custom VBA macro from the ribbon in Powerpoint2007?

M

martin-v

I created XML-code for a custom ribbon and saved it in a pptm-file.
When I open the pptm the ribbon is shown, but the code onAction won't run
("macro cannot be found").

Here's my XML:
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<ribbon startFromScratch="false">
<tabs>
<tab id="customTab" label="Menu-Macros">
<group id="CreateMenu" label="Create Menu">
<button id="MenuBuild"
label="Create a Menu"
imageMso="SlideMasterTextPlaceholderInsert"
size="large"
onAction="modMenue.CreateMenuRibbon"
screentip="Create a menu"/>
</group>
</tab>
</tabs>
</ribbon>
</customUI>

....and in modMenue my code
Sub CreateMenuRibbon(control As IRibbonControl)
CreateMenu ' This routine does the real work
End Sub

Similar code in Word runs fine.

I have no idea how to go on :(

Thank you for your help!
Martin
 
A

Andy Pope

Hi,

Try dropping the reference to the module.

onAction="CreateMenuRibbon"

Cheers
Andy
 
J

\Ji Zhou [MSFT]\

Hello Martin,

One more thing to mention is that the attached PowerPoint file is only
available when accessing the newsgroup via Windows Mail/Outlook Express. We
cannot see the attachment from Web Newsgroup. The following link describes
how to access Internet Explorer newsgroups using Outlook Express,
http://www.microsoft.com/windows/ie/support/newsgroups/howto.mspx.


Best regards,
Ji Zhou ([email protected], remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

This posting is provided "AS IS" with no warranties, and confers no rights.
 
M

martin-v

Hello Ji Zhou,

now I see what the problem was.

I did all the steps you described - and it worked.
They were the same I did before - with one slight difference: I had saved
the File as .potm (instead of .pptm).
But: when I opened the (working) .pptm, saved it as .potm and doubleclicked
the .potm to create a new presentation based on it I got the same behaviour
as before.
The code is visible in the editor, but when I press F5 (or Alt-F8 in the
presentation) the list of macros is empty.
Now I tried to save this new presentation and I got the clue: It tried to
save as .pptx-File. As soon as I saved it as .pptm-File, closed and reopened
it the macros worked!

Thank you, you made my day lots nicer ;)
Martin

--
2B||!2B?


""Ji Zhou [MSFT]"" said:
Good morning Martin! Thanks for using Microsoft Newsgroup Support Service,
my name is Ji Zhou [MSFT] and I will be working on this issue with you.

I use the same ribbon xml file and VBA routine as yours, but I cannot
reproduce this issue on my side. When I press the new created button on the
ribbon, the PowerPoint will always find and call my VBA routine correctly.
The following is what I have done on my side. If my steps have any
difference from yours, please let me know.

1.Firstly, I downloaded a ribbon customization tool "Custom UI Editor Tool"
from this link
http://openxmldeveloper.org/archive/2006/05/26/CustomUIeditor.aspx

2.I opened the PowerPoint application. A blank PowerPoint file was created
by default and I saved it as .pptm file(Macro Enabled PowerPoint) into the
D:\

3.I started the tool "Custom UI Editor Tool", used it to open the .pptm
file created in step 2, and pasted your ribbon xml string into the editor.

<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<ribbon startFromScratch="false">
<tabs>
<tab id="customTab" label="Menu-Macros">
<group id="CreateMenu" label="Create Menu">
<button id="MenuBuild" label="Create a Menu"
imageMso="SlideMasterTextPlaceholderInsert" size="large"
onAction="modMenue.CreateMenuRibbon" screentip="Create a
menu"/>
</group>
</tab>
</tabs>
</ribbon>
</customUI>

I clicked the Save button in the tool's command bar. This automatically
added the folder and XML file to the document container and created the
relationship for us.

4.I opened the .pptm file in PowerPoint application, and pressed Alt+F11 to
show up the VBA IDE. Afterwards, I created a module named modMenue and
inputted the following VBA routine codes into that module.

Sub CreateMenuRibbon(control As IRibbonControl)
MsgBox "test"
End Sub

5.I saved the .pptm file and navigated the ribbon to Tab "Menu-Macros",
clicked "Create a Menu" button. A message box with "test" string popped up.

Would you like to try my steps on your side to see if it works? And I have
also attached the PowerPoint file I created in this post for your testing.
If the problem still exists, could you please provide your created
powerpoint file to me for a troubleshooting purpose. You can access me by
the following email, (e-mail address removed).

Have a nice day!



Best regards,
Ji Zhou ([email protected], remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://support.microsoft.com/select/default.aspx?target=assistance&ln=en-us.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights
 
J

\Ji Zhou [MSFT]\

Hello Martin,

I am glad to hear that the issue is resolved. Thus I am going to close this
thread at this time. If you have any other questions or concerns, please do
not hesitate to let me know. I am more than happy if I can provide any
future help! Thanks again for using the Microsoft Newsgroup Service!

Have a nice weekend!

Best regards,
Ji Zhou ([email protected], remove ‘online.’)
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

This posting is provided "AS IS" with no warranties, and confers no rights.



martin-v said:
Hello Ji Zhou,

now I see what the problem was.

I did all the steps you described - and it worked.
They were the same I did before - with one slight difference: I had saved
the File as .potm (instead of .pptm).
But: when I opened the (working) .pptm, saved it as .potm and
doubleclicked
the .potm to create a new presentation based on it I got the same
behaviour
as before.
The code is visible in the editor, but when I press F5 (or Alt-F8 in the
presentation) the list of macros is empty.
Now I tried to save this new presentation and I got the clue: It tried to
save as .pptx-File. As soon as I saved it as .pptm-File, closed and
reopened
it the macros worked!

Thank you, you made my day lots nicer ;)
Martin

--
2B||!2B?


""Ji Zhou [MSFT]"" said:
Good morning Martin! Thanks for using Microsoft Newsgroup Support
Service,
my name is Ji Zhou [MSFT] and I will be working on this issue with you.

I use the same ribbon xml file and VBA routine as yours, but I cannot
reproduce this issue on my side. When I press the new created button on
the
ribbon, the PowerPoint will always find and call my VBA routine
correctly.
The following is what I have done on my side. If my steps have any
difference from yours, please let me know.

1.Firstly, I downloaded a ribbon customization tool "Custom UI Editor
Tool"
from this link
http://openxmldeveloper.org/archive/2006/05/26/CustomUIeditor.aspx

2.I opened the PowerPoint application. A blank PowerPoint file was
created
by default and I saved it as .pptm file(Macro Enabled PowerPoint) into
the
D:\

3.I started the tool "Custom UI Editor Tool", used it to open the .pptm
file created in step 2, and pasted your ribbon xml string into the
editor.

<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<ribbon startFromScratch="false">
<tabs>
<tab id="customTab" label="Menu-Macros">
<group id="CreateMenu" label="Create Menu">
<button id="MenuBuild" label="Create a Menu"
imageMso="SlideMasterTextPlaceholderInsert"
size="large"
onAction="modMenue.CreateMenuRibbon" screentip="Create
a
menu"/>
</group>
</tab>
</tabs>
</ribbon>
</customUI>

I clicked the Save button in the tool's command bar. This automatically
added the folder and XML file to the document container and created the
relationship for us.

4.I opened the .pptm file in PowerPoint application, and pressed Alt+F11
to
show up the VBA IDE. Afterwards, I created a module named modMenue and
inputted the following VBA routine codes into that module.

Sub CreateMenuRibbon(control As IRibbonControl)
MsgBox "test"
End Sub

5.I saved the .pptm file and navigated the ribbon to Tab "Menu-Macros",
clicked "Create a Menu" button. A message box with "test" string popped
up.

Would you like to try my steps on your side to see if it works? And I
have
also attached the PowerPoint file I created in this post for your
testing.
If the problem still exists, could you please provide your created
powerpoint file to me for a troubleshooting purpose. You can access me by
the following email, (e-mail address removed).

Have a nice day!



Best regards,
Ji Zhou ([email protected], remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you.
Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent
issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each
follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://support.microsoft.com/select/default.aspx?target=assistance&ln=en-us.
==================================================
This posting is provided "AS IS" with no warranties, and confers no
rights
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top