Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
4.50/5 (2 votes)
See more:
Hi
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
VB
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.

Regards
AR
Posted
Comments
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    
Ankit,
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    
Hi,
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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900