Go Back  Xtreme Visual Basic Talk > Visual Basic .NET (2002/2003/2005/2008, including Express editions) > .NET Office Automation > Error opening excel in a dll

Thread Tools Display Modes
Old 04-25-2012, 02:21 AM
michelleqw michelleqw is offline
Junior Contributor
Join Date: Jun 2005
Posts: 212
Default Error opening excel in a dll

Dear all,

We have created a dll to convert an excel spreadsheet to a csv file. At the moment we open the xls file, an eror occured (file doesn't exist / is used by an other user)

Maybe knows someone a solution.

Used code:
Dim excel As New Microsoft.Office.Interop.Excel.Application
Dim wb = excel.Workbooks.Open("d:\my.xls") '<<<<<<<<<<< not possible to open
wb.SaveAs("d:\my.csv", Microsoft.Office.Interop.Excel.XlFileFormat.xlTextMSDOS)

Nice regards,
Reply With Quote
Old 04-30-2012, 07:46 AM
Cerian Knight's Avatar
Cerian Knight Cerian Knight is offline

Super Moderator
* Expert *
Join Date: May 2004
Location: Michigan
Posts: 3,939

I don't have much use for .NET, but since no on else has responded... I've tried this code non-DLL (~5 minute using VS2010 Express is all I can tolerate ) and it works fine. Have you done so, as well?

I just want to be sure that this issue is only related to the DLL or how it is called (not e.g. a D:\ root permissions/FAT32 issue). That being the case, show us how it is called (and make sure it is called only once). Otherwise, make the files/file references in a folder and see if same result.

Also, couldn't help but notice the 'xlTextMSDOS'... which seems odd. Is that intentional (as opposed to 'xlCSV' or 'xlCSVMSDOS')?
Are your apps high DPI ready?
If you always do what others have done, you'll always be where others have been. I challenge you to do better... once the sleeper has awakened.
Reply With Quote

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..