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

  • Home
  • SEARCH
  • 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 112961
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T02:37:38+00:00 2026-05-11T02:37:38+00:00

I have an application written in VB.NET that interacts with Excel via interop. I

  • 0

I have an application written in VB.NET that interacts with Excel via interop. I eventually ran into the known issue of Cell-edit mode (see MSDN and stackoverflow for some background).

I have been trying to convert the suggested code to VB.NET but keep getting the following error:

Reference required to assembly 'office, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' containing the type 'Microsoft.Office.Core.CommandBars'. Add one to your project. (BC30652) - E:\ ... .vb:3471 

The original C# code (from previosuly mentioned articles) is as follows

private bool IsEditMode() {    object m = Type.Missing;    const int MENU_ITEM_TYPE = 1;    const int NEW_MENU = 18;     // Get the 'New' menu item.    CommandBarControl oNewMenu = Application.CommandBars['Worksheet Menu Bar'].FindControl(MENU_ITEM_TYPE, NEW_MENU, m, m, true );    if ( oNewMenu != null )   {      // Check if 'New' menu item is enabled or not.      if ( !oNewMenu.Enabled )      {         return true;      }   }   return false; } 

My converted VB.NET code is as follows

Private Function isEditMode() As Boolean     isEditMode = False     Dim m As Object = Type.Missing     Const  MENU_ITEM_TYPE As Integer = 1     Const  NEW_MENU As Integer = 18      Dim oNewMenu As Office.CommandBarControl     ' oExcel is the Excel Application object      ' the error is related to the below line     oNewMenu = oExcel.CommandBars('Worksheet Menu Bar').FindControl(MENU_ITEM_TYPE, NEW_MENU, m, m, True)     If oNewMenu IsNot Nothing Then         If Not oNewMenu.Enabled Then             isEditMode = True         End If     End If End Function 

I have added a (COM) reference to the Microsoft Office Object Library

Imports Office = Microsoft.Office.Core Imports Microsoft.Office.Interop 

I am kind of stuck. I already have tried indirectly referencing the CommandBar object, and re-adding refrences but can not figure out what is the problem. any ideas?

  • 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. 2026-05-11T02:37:38+00:00Added an answer on May 11, 2026 at 2:37 am

    As a quick-and-dirty fix i used the following code as an alternative

    Private Function isEditMode() As Boolean     isEditMode = False     Try         oExcel.GoTo('###')     Catch Ex As Exception        ' Either returns 'Reference is not valid.'         ' or 'Exception from HRESULT: 0x800A03EC'        If ex.Message.StartsWith('Exception') then isEditMode  = True     End Try      End Function 

    The .GoTo function (and corresponding menu item) is not available when Excel is in Cell-edit mode. Giving the .GoTo function a dummy destination will do nothing and won’t affect anything if the user is working in the cell when the code runs.

    An added extra is that no reference to the Microsoft Office Object (Microsoft.Office.Core) library is needed.

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

Sidebar

Ask A Question

Stats

  • Questions 65k
  • Answers 65k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer With bash: while true ; do run_proc & PID=$! sleep… May 11, 2026 at 11:01 am
  • added an answer Unfortunately Rails doesn't let you nest has_many's more than 2… May 11, 2026 at 11:01 am
  • added an answer With NULL you have to use IS or IS NOT.… May 11, 2026 at 11:01 am

Related Questions

I have an application written in VB.NET that interacts with Excel via interop. I
I have written some code in my VB.NET application to send an HTML e-mail
I have an application written in java, and I want to add a flash
I have an application written in Delphi 7 which does not require an admin
I have an application written in C#.Net (Framework 2.0 if it matters). It calls
Question I have an application written in Java. It is designed to run on
Background I have an application written in native C++ over the course of several
Background: I have an application written in native C++ which uses the wxWidgets toolkit's
Ok, I have an application written in C#. We have data in an SQL
Let's say I have an existing application written in Java which I wish to

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.