none
CS0103 The name "ribbon" does not exist in the current context

    Question

  • Hello!

    I'm trying to create custome ribbon menu in PowerPoint according to this article "Creating PowerPoint 2007 Add-Ins by Using Visual Studio 2005 Tools for the Office System SE" in the msdn.microsoft site and have gotten stuck in the and part "To determine the pressed state of the ToggleButton control" par.4. It says "In the ThisAddIn class in the Ribbon1.vb file (I use Ribbon1.cs), add support for handling the VisibleChanged event for the task pane. Add this event handler to the class, which calls the Refresh method for the Ribbon1 class and updates the pressed state of the toggle button when the visibility changes."

    And the code is

    private void HandleVisibleChanged(Object sender, EventArgs e)
    {
        ribbon.Refresh();
    }

    But there is no ThisAddIn class in Ribbon1.cs file, there is only "public class Ribbon1 : Office.IRibbonExtensibility". The class ThisAddIn is in the file ThisAddIn.cs So, I put the code to the ThisAddIn.cs file and now have the  Error CS0103  The name "ribbon" does not exist in the current context.

    If I put the code to the Ribbon1.cs file, I have the Error CS1061 'IRibbonUI' does not contain a definition for 'Refresh' and no extension method 'Refresh' accepting a first argument of type 'IRibbonUI' could be found (are you missing a using directive or an assembly reference?)

    Can you help to solve this problem, please? I'm new in C#, I'm following the article and now have gotten stuck and not sure how to fix those errors.

    Thanks in advance!


    • Edited by Lena Erik Monday, April 17, 2017 6:59 PM add link
    Sunday, April 16, 2017 5:13 PM

All replies