Click here to Skip to main content
12,398,816 members (54,261 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: VB MS-Excel
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
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 4-Jan-13 19:07pm
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)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160721.1 | Last Updated 9 Jan 2013
Copyright © CodeProject, 1999-2016
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