Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 117
Default Way to Override Policy & Use 2003 Vice 2007 Excel Interface (VB.NET)?

I am using the Visual Basic 2008 Express IDE to develop VB.NET code
that manipulates Excel files. I am developing on a PC that has both
Excel 2003 and 2007 installed. However, I need the code to run on a
PC with only Excel 2003 installed.

In the IDE I selected the Excel 2003 and Office 2003 COM interfaces as
References for my project. There are no references selected to the
Excel 2007 or Office 2007 COM interfaces. The code works find on my
PC, but I get an error when I try to run it on a PC with only Excel
2003 installed:

"Unhandled exception has occurred in your application. If you click
Continue, the application will ignore this error and attempt to
continue. If you click Quit, the application will close immediately.

Could not load file or assembly 'Microsoft.Office.Interop.Excel,
Version=12.0.0.0, . . . or one of its dependencies. The system cannot
find the file specified."

This indicates that the VB.NET code is looking for Excel 2007 (v. 12),
not Excel 2003 (v. 11).

Is there a way to override this to use 2003 only in my VB.NET project,
by modifying some policy?

Additional information from the error may be found below.

Also, I found an article at http://blogs.msdn.com/excel/archive/...19/636534.aspx
that says:

"In conjunction with the OM compatibility work we have done, we are
also shipping publisher policy files for the Office PIA’s. These will
automatically redirect code that is compiled against the 2003 PIA to
the new 2007 PIA so that existing code compiled against a 2003 PIA
will automatically be redirected to the corresponding 2007 PIA. As
with any publisher policy, in cases where you may not want to redirect
code to call the new PIA, you can override the policy by using the
following tag in an application configuration file shipped with your
managed assembly.

<publisherPolicy apply="no"/
"
However, I was not clear as to where or how to make that change, and
the link for more information is broken.

Thanks, Alan

************** Exception Text **************
System.IO.FileNotFoundException: Could not load file or assembly
'Microsoft.Office.Interop.Excel, Version=12.0.0.0, Culture=neutral,
PublicKeyToken=71e9bce111e9429c' or one of its dependencies. The
system cannot find the file specified.
File name: 'Microsoft.Office.Interop.Excel, Version=12.0.0.0,
Culture=neutral, PublicKeyToken=71e9bce111e9429c'
at HTMLcreator.MainForm.StartButton_Click(Object sender, EventArgs
e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventAr gs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons
button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.O nMessage
(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.W ndProc
(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32
msg, IntPtr wparam, IntPtr lparam)

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM
\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind
failure logging.
To turn this feature off, remove the registry value [HKLM\Software
\Microsoft\Fusion!EnableLog].



************** Loaded Assemblies **************
mscorlib
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.1873 (QFEN-1.050727-1800)
CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
HTMLcreator
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///D:/Documents%20and%20Settings/james.a.THOMAS/My%20Documents/VBA/HTMLcreator/HTMLcreator.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0..0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
Microsoft.VisualBasic
Assembly Version: 8.0.0.0
Win32 Version: 8.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.VisualBasic/8.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll
----------------------------------------
System.Configuration
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Configuration/2.0..0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 117
Default Way to Override Policy & Use 2003 Vice 2007 Excel Interface(VB.NET) ?

Now I see the problem, but I could not fix it. . . .

The References say 11.0 object libraries, but their paths are set to
the 12.0 libraries, e.g.: C:\Windows\assembly\GAC\Office
\12.0.0.0__71e9bce111e9429c\Office.dll.

I tried browsing to the specific directory for Excel 2003 and
selecting Excel, but the path is still wrong.

Any idea how I can correct this?

Thanks, Alan

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Applying 2003 User interface to Excell 2007 MH Excel Discussion (Misc queries) 3 February 24th 10 04:11 PM
Excel 2007 cannot open Excel 2003 documents. Registry Policy Setti Gordon Gecko Setting up and Configuration of Excel 0 March 4th 09 02:19 AM
VBA to VB6 DLL, interface split to support Excel 2000-2003, 2007 Roger That Excel Programming 5 May 29th 08 07:19 PM
Macro Security for Excel 2007 (group policy) justmark Setting up and Configuration of Excel 3 July 29th 07 12:53 PM
How do I override fixed decimal place settings in EXcel 2003? jroyv Excel Worksheet Functions 2 February 11th 05 06:07 PM


All times are GMT +1. The time now is 07:11 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"