0

I have a visual basic application where I open an excel file and process the data in the file. I import Microsoft Office Interop at the beginning of my code to allow me to access the excel file. My application runs properly on my local development machine (which has excel installed on it) but gets a dialog error when I deploy it to my companies server (where it will reside and be launched every day by a scheduled task).

This is the error that I get when I try to run the application on the server:

************** Exception Text **************
System.Runtime.InteropServices.COMException (0x80040154): Retrieving the 
COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} 
failed due to the following error: 80040154 Class not registered 
(Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
  at 
System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean 
publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& 
ctor, Boolean& bNeedSecurityCheck)at 
System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, 
Boolean fillCache, StackCrawlMark& stackMark)
at 
System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.Activator.CreateInstance(Type type)
at VPA_password_database_update.Form1.convertCredFile(String testOrLive)
at VPA_password_database_update.Form1.Form1_Load(Object sender, EventArgs e)
at System.EventHandler.Invoke(Object sender, EventArgs e)
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

I installed my application on a co-workers machine (which has excel installed on it) and the application runs fine.

I believe excel is not installed on my companies server (where the application needs to reside).

I was under the impression that with the import of the Microsoft Office Interop, I would not need to have Excel installed on the machine running the application.

Is that impression incorrect?

Thanks.

Jonathan Small
  • 773
  • 3
  • 12
  • 31
  • 4
    Excel is not made to be run on a server. There are many third-party .NET Excel libraries to choose from which are intended for that purpose. – Andrew Morton Sep 12 '19 at 19:09
  • 1
    Thanks @AndrewMorton I went with NPOI and with a few slight changes was able to process my excel file without having to have excel installed on my companies server. – Jonathan Small Sep 13 '19 at 00:14
  • Possible duplicate of [How to create an instance of Excel if Excel is not installed](https://stackoverflow.com/questions/12375943/how-to-create-an-instance-of-excel-if-excel-is-not-installed) - the answer is the same even though it asks in C# instead of VB.NET. Glad to hear you found a suitable library :) – Andrew Morton Sep 13 '19 at 07:51

0 Answers0