miércoles, 18 de abril de 2012 22:37
I am using VS 2008 and programming with VB.net
I have created a ribbon xml add-in for Excel 2007. I want to allow the user to create their own button in a dynamic menu, but I'm unsure how to begin.
Here is more detail: The user will create a worksheet template...the user will click the "Save Template" button that is programmed on to the ribbon...this will pop-up a form that asks for the file/button name they want to apply to this template...the user enters the name into the forms text box and clicks the "Save" button...the template is then saved in the default folder. This much I have worked out, and it is working fine.........Now for the part I can't figure out: After the user clicks the "Save" button on the form, and the worksheet is saved to the default folder, I want this "Save" button click event to also add a new button into Dynamic Menu1 on MyRibbon1...the label on the button should be the text the user entered into the forms text box...this new button should link back to the saved template file and be able to add that template to any workbook. I know how to add the worksheet to any active workbook...what I don't know is:
1. How to dynamically create the new button.
2. How to dynamically link that button back to the saved template.
Any assistance would be greatly appreciated...
Todas las respuestas
jueves, 19 de abril de 2012 18:02Anyone?
jueves, 19 de abril de 2012 18:31i think that after initialization phase of ribbon you cannot add new controls there. You could however work around this by adding some numbers of hidden buttons with callbacks for text and visibility and after user action simply call Invalidate on ribbon to show your control with dynamically generated text
jueves, 19 de abril de 2012 20:11
Though I have not done it, I understand if you use Ribbon Designer and not Ribbon XML that it is possible to alter some custom controls at runtime. This article provides information: Accessing the Ribbon at Runtime.
Kind Regards, Rich ... http://greatcirclelearning.com
- Marcado como respuesta Tom_Xu_WXModerator lunes, 23 de abril de 2012 8:26
jueves, 19 de abril de 2012 23:10
Wow!!! This is really becoming a struggle.
Anyway, I thought I would try a different approach...have the user save their template to the default folder...loop through this folder to create a button or each file in the folder.
Here is the link to a new thread I started that will explain it in more detail: