none
Custom Word 2007 Ribbon (C# Button Click Event Help) RRS feed

  • Question

  • I am working on a customized Office 2007 ribbon for Microsoft Word.  I am using Visual Studios 2008 and c#

    I need help with an on button click event (example code)  I have a drop down box with labels for legal disclaimer codes. When the appropriate disclaimer code is selected from the drop down box and the user presses the insert button, I would like for it to output the disclaimer notice at the cursors insertion point.  Can someone help get me get started? I already have code for the ribbon, just need help on the button click events.

    Thursday, November 18, 2010 4:34 PM

Answers

  • Hi,

    I made a working sample addressing your requirements:

    http://cid-a3a26f0fa9535013.office.live.com/self.aspx/Code/Office/InsertText2008.zip

    Hope this helps. Let me know if this is what you are needing.

    Regards,

    Mauro


    castagnasso.wordpress.com | If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".
    Tuesday, November 30, 2010 3:06 AM

All replies

  • Hi,

    Correct me if I'm wrong, but seems that your question is related with another thread: http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/f6386e47-374d-46ea-b33f-b174613a584f.

    I can help you with sample code, but I need to know some things before:

    • Are you using VSTO?
    • If so, are you using Ribbon Designer or Ribbon XML?
    Regards,
    Mauro

     


    castagnasso.wordpress.com
    Thursday, November 18, 2010 5:46 PM
  • Hi jthwong

    Is this a VSTO add-in? VSTO document-level customization? Shared Add-in?

    If VSTO, are you using the Ribbon Designer or RibbonXML?

    Is the problem that you don't know how to create an event, or is the problem with using Word's object model (the code that goes into the event)? Or is the problem getting the selection from the dropdown control?

    If the last, please specify exactly the type of Ribbon control (exactly as you see it in the Toolbox if this is the Designer or the term you used in the Ribbon XML).


    Cindy Meister, VSTO/Word MVP
    Thursday, November 18, 2010 5:49 PM
    Moderator
  • Thanks for the replies.  I will try and answer the questions, best to my knowledge.  I've created it as a shared add-in. Is it better to create it as a VSTO add-in?  I basically found a walk through tutorial on creating office ribbons and have used that as a starting guide. Yes, I did post in another forum section of MSDN, but someone said I should post in the Word section, to get help with the ribbon.

    I believe I am using RibbonXML. I created the group, combo box, labels etc and linked it to my .cs using Stream stream = asm.GetManifestResourceStream("Ribbon.Resources.Ribbon.xml")

    If someone can help provide sample code for the below event:

    If the label from combo box is = disclaimer code 1 and button insert is pressed, output the full disclaimer code at the cursor current insert point.


     

     

    Monday, November 29, 2010 6:29 PM
  • Hi,

    I made a working sample addressing your requirements:

    http://cid-a3a26f0fa9535013.office.live.com/self.aspx/Code/Office/InsertText2008.zip

    Hope this helps. Let me know if this is what you are needing.

    Regards,

    Mauro


    castagnasso.wordpress.com | If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".
    Tuesday, November 30, 2010 3:06 AM
  • Hi jthwong,

    I'm writing to check the status of the thread. Could you please let me know if you have solved the problem?

    Best Regards,
    Amy Li
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
    Tuesday, November 30, 2010 9:19 AM
    Moderator
  • I will need to redownload the file, but the page is down:

    "We can't show you that page Our server is having a problem. We're working to fix it as soon as we can, so try again in a few minutes"

    Thank you both for the help and follow-ups.

    Tuesday, November 30, 2010 5:22 PM