ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Changing save as file format for excel from VB.net (https://www.excelbanter.com/excel-programming/349896-changing-save-file-format-excel-vbulletin-net.html)

johnrc

Changing save as file format for excel from VB.net
 

Hi,
Can anyone help please.
I am trying to change the save as in Excel through VB.net from a cs
type back to an xls. I have attached the code below that i am using bu
it fails to run with:-

An unhandled exception of type 'System.IO.IOException' occurred i
microsoft.visualbasic.dll

Additional information: The process cannot access the fil
"C:\temp\temp.csv" because it is being used by another process.

My Code:-
excelApp.ActiveWorkbook.SaveAs(Filename:="C:\Temp\ Temp.xls"
FileFormat:=("xlExcel5"), _
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False
_
CreateBackup:=False)
excelApp.Visible = True

Any help appreciate

--
johnr
-----------------------------------------------------------------------
johnrc's Profile: http://www.excelforum.com/member.php...fo&userid=3026
View this thread: http://www.excelforum.com/showthread.php?threadid=49936


Tom Ogilvy

Changing save as file format for excel from VB.net
 
? xlExcel5
39

use the number 39

this might be more preferable:

? xlworkbooknormal
-4143


--
Regards,
Tom Ogilvy


"johnrc" wrote in
message ...

Hi,
Can anyone help please.
I am trying to change the save as in Excel through VB.net from a csv
type back to an xls. I have attached the code below that i am using but
it fails to run with:-

An unhandled exception of type 'System.IO.IOException' occurred in
microsoft.visualbasic.dll

Additional information: The process cannot access the file
"C:\temp\temp.csv" because it is being used by another process.

My Code:-
excelApp.ActiveWorkbook.SaveAs(Filename:="C:\Temp\ Temp.xls",
FileFormat:=("xlExcel5"), _
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False,
_
CreateBackup:=False)
excelApp.Visible = True

Any help appreciated


--
johnrc
------------------------------------------------------------------------
johnrc's Profile:

http://www.excelforum.com/member.php...o&userid=30267
View this thread: http://www.excelforum.com/showthread...hreadid=499360





All times are GMT +1. The time now is 05:35 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com