none
VSTO templates doesn't load new ribbons RRS feed

  • Question

  • We have one VBA macro utility written for word 2003, we have updated old templates (.dot) to new vsto templates (.dotm) and its has cutomised ribbon associated. In VBA code i have written macro to attached new template with old 2003 document. It shows template is attached but ribbons doesn't load?

    Am i missing some event in my VSTO template project? or i need to call ribbon in VBA code somehow??

    Any help ?? 



    • Edited by vbaweja Wednesday, March 13, 2013 9:57 PM
    Wednesday, March 13, 2013 1:32 AM

Answers

  • Hi vbaweja

    A VSTO template attached to a normal document won't exhibit the same behavior as a non-VSTO template with a Ribbon or VBA code that's attached to a document. The VSTO extensions in the VSTO template will not be available to the attached document. The Ribbon, for example, is not stored in the template as is the case when you add a ribbon.xml to a Word file. Only when the VSTO extensions load will the Ribbon XML be loaded. But when a VSTO template is simply attached to a Word document, the extensions will not load.

    What is it, more exactly, that you hope to achieve with the approach you've chosen and are trying to implement?


    Cindy Meister, VSTO/Word MVP, my blog

    Thursday, March 14, 2013 9:43 AM
    Moderator
  • Hi vbaweja

    An Office 2003 document cannot load or work with a newer VSTO code-set. It can attach the document with which the code is associated, but the code won't function.

    You might try first using File/Save As to save the 2003 documents to the 2010 *.docx file format. But even then, I don't think attaching the VSTO template via the Templates dialog box (or using VBA) is going to attach the VSTO code. VSTO makes changes internally to files. If a file hasn't been generated directly from the template it will lack these changes.

    You may have to attach the code directly to old documents that have been saved in the new file format, as per this article:
      http://msdn.microsoft.com/en-us/library/bb772091.aspx

    Your other option would be to create an Add-in with the Ribbon and related code, rather than a VSTO template.


    Cindy Meister, VSTO/Word MVP, my blog

    Friday, March 15, 2013 3:42 PM
    Moderator

All replies

  • Hi vbaweja

    A VSTO template attached to a normal document won't exhibit the same behavior as a non-VSTO template with a Ribbon or VBA code that's attached to a document. The VSTO extensions in the VSTO template will not be available to the attached document. The Ribbon, for example, is not stored in the template as is the case when you add a ribbon.xml to a Word file. Only when the VSTO extensions load will the Ribbon XML be loaded. But when a VSTO template is simply attached to a Word document, the extensions will not load.

    What is it, more exactly, that you hope to achieve with the approach you've chosen and are trying to implement?


    Cindy Meister, VSTO/Word MVP, my blog

    Thursday, March 14, 2013 9:43 AM
    Moderator
  • HI Cindy,

    Thanks for you response. We are in process of migrating from Office 2003 to Office 2010. I have converted all templates containing VBA macros and customised toolbars(*.dot) to VSTO templates (*.dotm)with associated Ribbons. The VSTO ribbons in these templates calls the VBA macros already written. 

    When a user opens a new document, the template loads the ribbon. If a user opens an old 2003 document and attaches the new version of same template (.dot -> .dotm), word shows it has attached that template. However it doesn't load the associated ribbon.

    Is there any way to trigger this? or is there any event i can add in my VSTO template project  to call the ribbon? or as VBA is attaching the new template, Can i call the ribbon specifically?

    I hope its clear. Thanks in advance.

    Thursday, March 14, 2013 10:21 PM
  • Hi vbaweja

    An Office 2003 document cannot load or work with a newer VSTO code-set. It can attach the document with which the code is associated, but the code won't function.

    You might try first using File/Save As to save the 2003 documents to the 2010 *.docx file format. But even then, I don't think attaching the VSTO template via the Templates dialog box (or using VBA) is going to attach the VSTO code. VSTO makes changes internally to files. If a file hasn't been generated directly from the template it will lack these changes.

    You may have to attach the code directly to old documents that have been saved in the new file format, as per this article:
      http://msdn.microsoft.com/en-us/library/bb772091.aspx

    Your other option would be to create an Add-in with the Ribbon and related code, rather than a VSTO template.


    Cindy Meister, VSTO/Word MVP, my blog

    Friday, March 15, 2013 3:42 PM
    Moderator