Click here to Skip to main content
13,042,819 members (78,669 online)
Rate this:
Please Sign up or sign in to vote.
See more:

We are facing a issue with one of our VB 6.0 application.
There is line of code which convert a text file to excel file through Excel.Workbook.
This code works fine when we run through windows application.

But if we run the same exe from a windows service developed in C#.Net then it gives this error on this line
oWB.SaveAs FileName, XlFileFormat.xlExcel8

I have tried to search on google but didn't get any success.

Any suggestion will be very much helpful.

Thanks in Advance.

Posted 4-Jan-13 19:07pm
Richard MacCutchan 5-Jan-13 8:17am
That message suggests you have some serious corruption in your code or data, but you need to do some debugging to find it.
Debasis.logica 6-Jan-13 10:05am
after some googling on your specific problem; I found that it might be due to the following scenario:
the VB6 assembly uses a specific version of Microsoft Excel Interop dll whereas your C#.Net code uses a different version of Excel as reference. If this is the scenario; please try recompile the VB 6 code with the version used in .Net code and then try using that.

Please let me know and if possible please give the version details (MS Excel) (if problem persists). :)
Ankit Rajput 9-Jan-13 1:16am
Sorry for late reply.
Actually the same scenario is working fine on my pc with Windows XP.
and on both side we have installed Office 2007.
Another thing, we dont have any reference of excel in c# code.
Ankit Rajput 9-Jan-13 1:55am

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 9 Jan 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100