Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9112921
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T03:51:04+00:00 2026-06-17T03:51:04+00:00

I have created an excel 2007 workbook that has hidden worksheets in. There is

  • 0

I have created an excel 2007 workbook that has hidden worksheets in. There is one worksheet unhidden that has commands buttons with each worksheet name on each command button. When a command button is clicked, the hidden worksheet should be made visible and the focus should be placed on that worksheet. The code below returns this error:

An object reference is required for the non-static field, method, or
property ‘Microsoft.Office.Tools.Excel.WorksheetBase.Visible get’

using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Xml.Linq;
using Microsoft.Office.Tools.Excel;
using Microsoft.VisualStudio.Tools.Applications.Runtime;
using Excel = Microsoft.Office.Interop.Excel;
using Office = Microsoft.Office.Core;

namespace TestProj
{
    public partial class Sheet17
    {
        private void Sheet17_Startup(object sender, System.EventArgs e)
        {
        }

        private void Sheet17_Shutdown(object sender, System.EventArgs e)
        {
        }

        #region VSTO Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InternalStartup()
        {
            this.button1.Click += new System.EventHandler(this.button1_Click);
            this.Startup += new System.EventHandler(this.Sheet17_Startup);
            this.Shutdown += new System.EventHandler(this.Sheet17_Shutdown);

        }

        #endregion

        private void checkedListBox1_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            Sheet5 How = new Sheet5();
            How.Visible = Excel.XlSheetVisibility.xlSheetVisible;
        }

    }
}

Can someone please help me with this error?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T03:51:05+00:00Added an answer on June 17, 2026 at 3:51 am

    Use like this;

    Sheet5 mySheet = new Sheet5();
    mySheet.Visible = Excel.XlSheetVisibility.xlSheetVisible; 
    

    or make your Sheet5 class static. You can’t access to your non-static class without any create an instance of this class.

    Read it from MSDN.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Excel 2007 with a workbook that has many sheets. I need
excel 2007 i have the following which happily creates a workbook and worksheet. How
I have created and Excel 2007 based dynamic charting application that that charts various
I have developed a dashboard in Excel 2007 that uses one source table in
we have created a VSTO Excel workbook with VS2010, .NET 4.0. After we publish
I have created a macro for excel which will pop up form that contains
I have created a xlt excel template which works fine in Excel 2007 under
I have created an Excel file from my JTable. The same button that creates
I have an excel 2007 worksheet open with 5 colums and +/-5000 rows of
I have an Excel 2007 workbook which I am using to connect to a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.