Disable the Excel 2007 compatibility check?
Disable the Excel 2007 compatibility check?
Disable the Excel 2007 compatibility check?
Disable the Excel 2007 compatibility check?
Disable the Excel 2007 compatibility check?
Disable the Excel 2007 compatibility check? Disable the Excel 2007 compatibility check? Disable the Excel 2007 compatibility check? Disable the Excel 2007 compatibility check? Disable the Excel 2007 compatibility check? Disable the Excel 2007 compatibility check? Disable the Excel 2007 compatibility check? Disable the Excel 2007 compatibility check?
Disable the Excel 2007 compatibility check? Disable the Excel 2007 compatibility check?
Disable the Excel 2007 compatibility check?
Go Back  Xtreme Visual Basic Talk > > > Disable the Excel 2007 compatibility check?


Reply
 
Thread Tools Display Modes
  #1  
Old 07-07-2009, 02:57 AM
Herou Herou is offline
Newcomer
 
Join Date: Jul 2009
Posts: 3
Default Disable the Excel 2007 compatibility check?


I have an application that browses through Excel-files, changes color in some cells if they are in a wrong format etc.

When my application is saving the changed file I get this alert about compatibility issues that can occur, and this alertbox has to be agreed or cancelled to move on to the next file.

How can I disable this compatibility check programmatically?

Or is there any way to ensure there are only Excel 2003 compatible colors in the document before saving?

All help I can get is appreciated!
Reply With Quote
  #2  
Old 07-07-2009, 08:38 AM
Mike Rosenblum's Avatar
Mike Rosenblum Mike Rosenblum is offline
Microsoft Excel MVP

Forum Leader
* Guru *
 
Join Date: Jul 2003
Location: New York, NY, USA
Posts: 7,848
Default

Hi Herou,

Welcome to the forum.

Could you tell us: are you using VBA or .NET for this?

One article I found using VBA was the following by Ken Puls, an Excel MVP:

Disable the Excel Compatibility Checker


The key is to set the CheckCompatibility for the workbook to False.

Give it a try and let us know how it goes...

Mike

(And tell us which language you are using so that we can move this post to the correct sub-forum, as necessary, thanks!)
__________________
My Articles:
| Excel from .NET | Excel RibbonX using VBA | Excel from VB6 | CVErr in .NET | MVP |
Avatar by Lebb
Reply With Quote
  #3  
Old 07-07-2009, 09:19 AM
Herou Herou is offline
Newcomer
 
Join Date: Jul 2009
Posts: 3
Default

Hi, thanks for the reply! I'm using VB.NET, I can't test your suggestion now but I will check into it tomorrow at work and reply to this thread if I come up with a solution.
Reply With Quote
  #4  
Old 07-07-2009, 12:12 PM
Mike Rosenblum's Avatar
Mike Rosenblum Mike Rosenblum is offline
Microsoft Excel MVP

Forum Leader
* Guru *
 
Join Date: Jul 2003
Location: New York, NY, USA
Posts: 7,848
Default

Ok, sounds good... Let us know!
__________________
My Articles:
| Excel from .NET | Excel RibbonX using VBA | Excel from VB6 | CVErr in .NET | MVP |
Avatar by Lebb
Reply With Quote
  #5  
Old 07-08-2009, 01:57 AM
Herou Herou is offline
Newcomer
 
Join Date: Jul 2009
Posts: 3
Default

The following code seems to work, it is a setting on the Excel application object:

Code:
MyExcelApp.DisplayAlerts = False
So it seems it was easier than I thought.

Cheers!
Reply With Quote
  #6  
Old 07-08-2009, 11:08 AM
Mike Rosenblum's Avatar
Mike Rosenblum Mike Rosenblum is offline
Microsoft Excel MVP

Forum Leader
* Guru *
 
Join Date: Jul 2003
Location: New York, NY, USA
Posts: 7,848
Default

Yes, I should have pointed that out. That's the key line in Ken Puls' code.

His event trapping is necessary if you want to suppress the message the compatibility checker for all workbooks.

Glad you're on your way, Herou...

Mike
__________________
My Articles:
| Excel from .NET | Excel RibbonX using VBA | Excel from VB6 | CVErr in .NET | MVP |
Avatar by Lebb
Reply With Quote
  #7  
Old 08-14-2009, 09:21 AM
Mash2004 Mash2004 is offline
Newcomer
 
Join Date: Aug 2009
Posts: 3
Default Excel 2007 Compatibility Checker (Arrrggh)

Quote:
Originally Posted by Herou View Post
The following code seems to work, it is a setting on the Excel application object:

Code:
MyExcelApp.DisplayAlerts = False
So it seems it was easier than I thought.

Cheers!
Hi All

I found that the above code would not work for me (although I'm using it in a c# application) but the following code seemed to do the trick...

Excel.Workbook statement = excelApp.Workbooks.Open(...);
.. do some stuff ...
statement.CheckCompatibility = false;
statement.Save();
statement.Close();

Hope that helps.
Mash
Reply With Quote
  #8  
Old 08-14-2009, 09:40 AM
Mike Rosenblum's Avatar
Mike Rosenblum Mike Rosenblum is offline
Microsoft Excel MVP

Forum Leader
* Guru *
 
Join Date: Jul 2003
Location: New York, NY, USA
Posts: 7,848
Default

Hi Mash, thanks for pointing that out.

I obviously read Herou's code example much too quickly. The key line in Ken Puls' article is:

Code:
Wb.CheckCompatibility = False
He puts this line within an event handler for the Excel.Application.WorkbookBeforeSave event:

Code:
Private Sub App_WorkbookBeforeSave(ByVal Wb As Workbook, ByVal SaveAsUI As Boolean, Cancel As Boolean)
'Date Created : 9/24/2008 19:59
'Author       : Ken Puls (www.excelguru.ca)
'Macro Purpose: Disable compatibility checker

    Wb.CheckCompatibility = False

End Sub
So your way and the Ken Puls' way are the same.

I don't know under what circumstances that Herou's code calling 'Application.DisplayAlerts = False' would work. It would seem that setting 'Workbook.CheckCompatiblity = False' would be the right way to go.

Thanks for setting us straight!

- Mike
__________________
My Articles:
| Excel from .NET | Excel RibbonX using VBA | Excel from VB6 | CVErr in .NET | MVP |
Avatar by Lebb
Reply With Quote
  #9  
Old 08-14-2009, 09:48 AM
Mash2004 Mash2004 is offline
Newcomer
 
Join Date: Aug 2009
Posts: 3
Default Excel 2007 Compatibility Checker (Arrrggh)

Hi Mike

Thanks for the reply.

The DisplayAlerts = false is normally wrapped around a close method to suppress asking the user if he wants to save the workbook before closing.

As shown here: http://msdn.microsoft.com/en-us/library/bb177478.aspx

Mash
Reply With Quote
  #10  
Old 08-14-2009, 09:52 AM
Mike Rosenblum's Avatar
Mike Rosenblum Mike Rosenblum is offline
Microsoft Excel MVP

Forum Leader
* Guru *
 
Join Date: Jul 2003
Location: New York, NY, USA
Posts: 7,848
Default

Ok, that makes sense. I don't know if it works with the Compatiblity Checker though. I've not tried myself, but I had thought that everyone's first attempt was to try DisplayAlerts = False (which works for most things, but not everything) and then people wind up on threads like this trying to figure it out...

Without testing it, I'm guessing that either DisplayAlerts = False does not work for suppressing the Compatibility Checker or at least does not do so consistently.

- Mike
__________________
My Articles:
| Excel from .NET | Excel RibbonX using VBA | Excel from VB6 | CVErr in .NET | MVP |
Avatar by Lebb
Reply With Quote
  #11  
Old 08-17-2009, 06:43 AM
Mash2004 Mash2004 is offline
Newcomer
 
Join Date: Aug 2009
Posts: 3
Default

All

Please note that it is best to check the version of Excel that is running whilst in code:

string version = ExcelApp.Version

and then test before attempting to turn off the CompatibilityChecker:

if(Convert.ToDouble(version) >= 12.0)
{
wb.CheckCompatibility = false;
}

Otherwise your app will error if running a previous version of Excel (in my case Excel 2003).

Hope this helps.

Mash
Reply With Quote
  #12  
Old 08-17-2009, 08:03 AM
Mike Rosenblum's Avatar
Mike Rosenblum Mike Rosenblum is offline
Microsoft Excel MVP

Forum Leader
* Guru *
 
Join Date: Jul 2003
Location: New York, NY, USA
Posts: 7,848
Default

Hi Mash,

Quote:
Originally Posted by Mash2004 View Post
Please note that it is best to check the version of Excel that is running whilst in code... Otherwise your app will error if running a previous version of Excel (in my case Excel 2003).
Yes, good point.

The other way to go is to use early binding so that you know which commands are available at compile time.

The code you are showing there is early-bound C# code, so the only way that you could have a problem is if you are referencing the Excel 2007 (12.0) PIAs and then later try to deploy and run on an Excel 2003 (11.0) installation. If you developed against the Excel 11.0 in the first place, the compiler would warn if attempting to make use of a non-existent command.

So the advice you give is definitely spot-on, but you also need to think about which PIAs against which you are developing, and to which you are deploying.

- Mike
__________________
My Articles:
| Excel from .NET | Excel RibbonX using VBA | Excel from VB6 | CVErr in .NET | MVP |
Avatar by Lebb
Reply With Quote
  #13  
Old 04-14-2010, 06:23 AM
spvarapu spvarapu is offline
Newcomer
 
Join Date: Apr 2010
Posts: 1
Default

Hi
I am working with Interop Excel 11 version and did not see CheckCompatibility property of Workbook.
Do you have any other solution?

Thanks
Sreenivas
Reply With Quote
  #14  
Old 04-17-2010, 08:05 AM
Mike Rosenblum's Avatar
Mike Rosenblum Mike Rosenblum is offline
Microsoft Excel MVP

Forum Leader
* Guru *
 
Join Date: Jul 2003
Location: New York, NY, USA
Posts: 7,848
Default

Hi Sreenivas,

The Workbook.CheckCompatibility property is only available for Excel 2007 (Excel 12.0) and above. If you are compiling against the Excel 2003 (11.0) PIAs, but your solution could be installed and run under Excel 2007, then you would have to:

(1) Check for which version of Excel is running, and

(2) If the Excel version is 12.0 or above, then call the Workbook.CheckCompatibility property via late binding.

Calling via late binding is not hard, but it differs depending on the language used. Tell us which language you are using and we will be able to help further...

-- Mike
__________________
My Articles:
| Excel from .NET | Excel RibbonX using VBA | Excel from VB6 | CVErr in .NET | MVP |
Avatar by Lebb
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Disable the Excel 2007 compatibility check?
Disable the Excel 2007 compatibility check?
Disable the Excel 2007 compatibility check? Disable the Excel 2007 compatibility check?
Disable the Excel 2007 compatibility check?
Disable the Excel 2007 compatibility check?
Disable the Excel 2007 compatibility check? Disable the Excel 2007 compatibility check? Disable the Excel 2007 compatibility check? Disable the Excel 2007 compatibility check? Disable the Excel 2007 compatibility check? Disable the Excel 2007 compatibility check? Disable the Excel 2007 compatibility check?
Disable the Excel 2007 compatibility check?
Disable the Excel 2007 compatibility check?
 
Disable the Excel 2007 compatibility check?
Disable the Excel 2007 compatibility check?
 
-->