LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
Pai Pai is offline
external usenet poster
 
Posts: 1
Default Programatically saving an excel .csv file to .xls file...

Hello there,

I have been trying to programatically save and excel test.csv to and test.xls.

I use the following code:

Dim excelapp As New Excel.Application
Set excelapp = New Excel.Application

excelapp.DisplayAlerts = False

Dim c As New Excel.Workbook
Dim f As New Excel.Worksheet

Set c = excelapp.Workbooks.Open(fileName)
Set f = c.Worksheets(1)

saved_Excel_WorkSheet_Name = f.Name

excelapp.SaveWorkspace (saved_Excel_File)

c.Close
Set f = Nothing
Set c = Nothing

excelapp.Quit
Set excelapp = Nothing

I realise that the .xls file is still linked to the .csv file.

As If i delete the .csv file I am unable to open the file.

I tried using the WorkBook.SaveCopyAs method but the format of the data is lost...

whcih is the best way to programatically save a .csv file to .xls.

Thanks in advance,
Srikanth Pai
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Saving Excel 2007 file in 2003 creates very large file Jon Pearce Excel Discussion (Misc queries) 2 July 16th 09 07:20 PM
Excel should let me sort the file directory when saving a file Beanee70 Excel Discussion (Misc queries) 0 March 14th 06 07:03 AM
Saving an excel file without it amending the name of file name Jenny Excel Discussion (Misc queries) 0 January 19th 06 09:03 AM
How do I stop Excel 2000 from saving file history from file that . Cathy Excel Discussion (Misc queries) 0 March 29th 05 03:27 PM
Creating a PDF file programatically from Excel Chaplain Doug Excel Discussion (Misc queries) 0 December 16th 04 08:49 PM


All times are GMT +1. The time now is 06:13 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"