Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Saving a sheet in a workbook as .csv but not changing workbook name


Hi everyone,

Thanks for your help on my previous question, it has led me to another
problem:

I have a workbook called work.xls with three sheets, one of which is
called data.

I want to save a copy of data sheet as a csv file called data.csv. This
is easily done using the below code. My problem is I do not want the
name of the current sheet to change when I have done this. In other
words I don't want to save the current workbook as data.csv, but just
the sheet "data". The workbook should remain as work.xls.

This is the code that doesnt work properly:

Sheets("Data").Select
Range("A1").Select

ActiveWorkbook.SaveAs Filename:= _
"C:\Documents and Settings\Alex\Desktop\data.csv", FileFormat:=
_
xlCSV, CreateBackup:=False


--
gloryofbach
------------------------------------------------------------------------
gloryofbach's Profile: http://www.excelforum.com/member.php...o&userid=28322
View this thread: http://www.excelforum.com/showthread...hreadid=480090

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Saving a sheet in a workbook as .csv but not changing workbook name


Sheets("Data").Select
Sheets("Data").Copy


ActiveWorkbook.SaveAs Filename:= _
"C:\Data.csv", FileFormat:=xlNormal, _
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False,
_
CreateBackup:=False

ActiveWindow.Close


--
Kaak
------------------------------------------------------------------------
Kaak's Profile: http://www.excelforum.com/member.php...fo&userid=7513
View this thread: http://www.excelforum.com/showthread...hreadid=480090

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Saving a sheet in a workbook as .csv but not changing workbook name


Hello Kaak,

Thank you very much for your considered reply - funny enough your
method is the exact same way I am doing it. My issue is that I am
saving the data.csv every 20 seconds for 8 hours a day (the process
runs on a timer to ensure data.csv is always up to date). In this sense
the method seems rather inelegant, as you are having to create a new
workbook each time etc and the temporary workbook number is Book1
etc... by the end of the day it will be book1500 etc...

This isnt a big deal but I am surprised you cannot use savecopyas
function to save a sheet as a csv file!

Is my understanding correct?

Alex


--
gloryofbach
------------------------------------------------------------------------
gloryofbach's Profile: http://www.excelforum.com/member.php...o&userid=28322
View this thread: http://www.excelforum.com/showthread...hreadid=480090

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Saving a sheet in a workbook as .csv but not changing workbook name

If the workbook is a CSV, then savecopyAs saves a copy as CSV.

--
Regards,
Tom Ogilvy

"gloryofbach"
wrote in message
...

Hello Kaak,

Thank you very much for your considered reply - funny enough your
method is the exact same way I am doing it. My issue is that I am
saving the data.csv every 20 seconds for 8 hours a day (the process
runs on a timer to ensure data.csv is always up to date). In this sense
the method seems rather inelegant, as you are having to create a new
workbook each time etc and the temporary workbook number is Book1
etc... by the end of the day it will be book1500 etc...

This isnt a big deal but I am surprised you cannot use savecopyas
function to save a sheet as a csv file!

Is my understanding correct?

Alex


--
gloryofbach
------------------------------------------------------------------------
gloryofbach's Profile:

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



Reply
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
specify each sheet name when saving workbook as html [email protected] Excel Discussion (Misc queries) 3 May 7th 07 07:01 PM
Changing the name of a workbook without saving it Maury Markowitz Excel Programming 2 October 27th 05 03:56 PM
Saving one sheet within a workbook David Vollmer Excel Discussion (Misc queries) 2 September 14th 05 06:04 PM
saving sheet as new workbook Nigel Excel Programming 1 August 12th 05 02:35 AM
Saving only 1 sheet of a workbook Jay Wilson Excel Programming 4 February 2nd 04 04:38 PM


All times are GMT +1. The time now is 02:52 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"