Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. C#.NET 3.5 VS 2008 Excel 2007 Ribbon hide/show

C#.NET 3.5 VS 2008 Excel 2007 Ribbon hide/show

Scheduled Pinned Locked Moved C#
csharpvisual-studioquestion
6 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    Wheels012
    wrote on last edited by
    #1

    Good morning. I have created an Excel add-in to display a Import tab with several buttons designed to run VBA macros. I only want this tab to display on the one workbook and not every instance of Excel. I am trying to test for the specific spreadsheet name, but the If statement keeps defaulting to the else condition. I have the following:

    public RibbonCustom()
    {
    InitializeComponent();
    this.tabImport.Visible = true;
    //MessageBox.Show(Globals.ThisAddIn.Application.ThisWorkbook.FullName.ToString());
    if (Globals.ThisAddIn.Application.ThisWorkbook.FullName.ToString() == "ImportFile.xlsm") { this.tabImport.Visible = true; }
    else { this.tabImport.Visible = false; }
    }

    The MessageBox.Show doesn't work. Any suggestions? WHEELS

    L 1 Reply Last reply
    0
    • W Wheels012

      Good morning. I have created an Excel add-in to display a Import tab with several buttons designed to run VBA macros. I only want this tab to display on the one workbook and not every instance of Excel. I am trying to test for the specific spreadsheet name, but the If statement keeps defaulting to the else condition. I have the following:

      public RibbonCustom()
      {
      InitializeComponent();
      this.tabImport.Visible = true;
      //MessageBox.Show(Globals.ThisAddIn.Application.ThisWorkbook.FullName.ToString());
      if (Globals.ThisAddIn.Application.ThisWorkbook.FullName.ToString() == "ImportFile.xlsm") { this.tabImport.Visible = true; }
      else { this.tabImport.Visible = false; }
      }

      The MessageBox.Show doesn't work. Any suggestions? WHEELS

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      string theName = Globals.ThisAddIn.Application.ThisWorkbook.FullName.ToString();
      if (theName == "ImportFile.xlsm")
      {
      this.tabImport.Visible = true;
      }
      else
      {
      this.tabImport.Visible = false;
      }

      Put a breakpoint on the declaration of theName, and run the code. Somehow, those two strings aren't the same.

      I are Troll :suss:

      W 1 Reply Last reply
      0
      • L Lost User

        string theName = Globals.ThisAddIn.Application.ThisWorkbook.FullName.ToString();
        if (theName == "ImportFile.xlsm")
        {
        this.tabImport.Visible = true;
        }
        else
        {
        this.tabImport.Visible = false;
        }

        Put a breakpoint on the declaration of theName, and run the code. Somehow, those two strings aren't the same.

        I are Troll :suss:

        W Offline
        W Offline
        Wheels012
        wrote on last edited by
        #3

        Hi Eddy. I found one issue. I was using >FullName instead of .Name, but unfortunately it didn't fix the issue. Trying to figure out a way that I can see the contents of the code (variable).

        L 1 Reply Last reply
        0
        • W Wheels012

          Hi Eddy. I found one issue. I was using >FullName instead of .Name, but unfortunately it didn't fix the issue. Trying to figure out a way that I can see the contents of the code (variable).

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Wheels012 wrote:

          Trying to figure out a way that I can see the contents of the code (variable).

          That would be debugging[^]? :)

          I are Troll :suss:

          W 1 Reply Last reply
          0
          • L Lost User

            Wheels012 wrote:

            Trying to figure out a way that I can see the contents of the code (variable).

            That would be debugging[^]? :)

            I are Troll :suss:

            W Offline
            W Offline
            Wheels012
            wrote on last edited by
            #5

            Won't debug unfortunately.

            L 1 Reply Last reply
            0
            • W Wheels012

              Won't debug unfortunately.

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              Wheels012 wrote:

              Won't debug unfortunately.

              Tried to attach the debugger to Excel? If you can't debug, then you'd be limited to something like logging to a textfile.

              I are Troll :suss:

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups