locked
Default Template produce Error. ThisRibbonCollection : GetRibbon RRS feed

  • Question

  • I create a Excel 2010 Addin project in Visual Studio 2010 [Targeting .NET 4.0 Client profile, by default]

    I create a Folder within my project.

    Add a Ribbon [Designer] Control in newly created folder.

    Add some UDF class in seperate folder.

    Compile and get this error

    'xxx.xxx.ThisRibbonCollection' does not contain a definition for 'GetRibbon' and no extension method 'GetRibbon' accepting a first argument of type 'xxx.xxx..ThisRibbonCollection' could be found (are you missing a using directive or an assembly reference?)

    Here is auto generated code for the same.

    partial class ThisRibbonCollection
        {
            internal AcousticalRibbon AcousticalRibbon
            {            
                get { return this.GetRibbon<AcousticalRibbon>(); }
            }
          
        }

    I read in older blog post, referring mainly to VSTO 3.0 [I am using VSTO 4.0] to extend this class with MS.Office.Tools.Ribbon.RibbonReadOnlycollection, However when I did that it ask to implement other Interface method, which are though some basic method of object, but not sure what to write code for them and hence I am not very please to implement them unless that is the only method. Any idea why I am getting this error ?


    Sumit Gupta http://www.sumitgupta.net

    Tuesday, February 28, 2012 8:32 AM

Answers

  • Okay, This is wired but the problem was in using a FOLDER to put ribbon. In order to organize my code, I have put ribbon in a folder. This cause the ThisRibbonCollection loose its namespace with Basic application. So I just modify the partial class and take it out of PRoject.Folder to Project Namespace and correct reference.

    Sumit Gupta http://www.sumitgupta.net

    • Marked as answer by Vikasumit Tuesday, February 28, 2012 10:00 AM
    Tuesday, February 28, 2012 10:00 AM

All replies

  • I just create a new TEST project using Template EXCEL 2010 AddIn, Add Ribbon Designer into this. And Get Same error, so I am sure my custom code is not a problem there. Any Idea ?

    Sumit Gupta http://www.sumitgupta.net

    Tuesday, February 28, 2012 9:42 AM
  • Okay, This is wired but the problem was in using a FOLDER to put ribbon. In order to organize my code, I have put ribbon in a folder. This cause the ThisRibbonCollection loose its namespace with Basic application. So I just modify the partial class and take it out of PRoject.Folder to Project Namespace and correct reference.

    Sumit Gupta http://www.sumitgupta.net

    • Marked as answer by Vikasumit Tuesday, February 28, 2012 10:00 AM
    Tuesday, February 28, 2012 10:00 AM