Click here to Skip to main content
14,921,505 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
VB
oWB.SaveAs(Filename:="C:\target\Testxls", FileFormat:=Excel.XlFileFormat.xlCSV)

This is how I save the Excel file I created, but when I checked the file, the formatting is ruined? :(

How can I avoid it?

Thanks.
Posted
Updated 7-Mar-12 22:49pm
v2

1 solution

You are specifying Comma Separated Value format in the SaveAs method. This format cannot store the format information of excel file. You can choose one of the formats, which suits your requirement, from the list given here
http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel.xlfileformat.aspx[^]
   
v2
Comments
Maciej Los 8-Mar-12 8:19am
   
My 5! Very good and short answer!
ProEnggSoft 8-Mar-12 8:33am
   
Thank you Iosmac
Alan Tuscano 8-Mar-12 19:26pm
   
Thanks ProEnggSoft, It Worked! :)
Also, my 5 to u.
ProEnggSoft 8-Mar-12 19:33pm
   
Thanks

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