View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Brad[_26_] Brad[_26_] is offline
external usenet poster
 
Posts: 10
Default Looping Open and Save as CSV

Also how do I get my simple macro to stop asking about overwriting the
existing CSV file and just do it?

Brad

Excel 2002 on XP Pro SP 3

"Brad" wrote in message
...
I have to open worksheets and then save them as CSV files for another
program. When I used the macro recorder, it copied the entire path so that
when I run macro is puts the file back in the same folder every time
regardless of path for the XLS file. All the file names are VOLUME, but
the path changes for the various options. How do I edit the macro below to
get it to save XLS files as CSV files in the same directory that the XLS
file cam from instead of the one where I initially recorded the macro?

Active..SaveAs Filename:= _
"Y:\Yarger Engineering\20090802\Synchro\Phase 1
(2011)\Sunday\AM\VOLUME.csv" _
, FileFormat:=xlCSV, CreateBackup:=False

If it makes any difference, I do this all the time, but the path structure
changes from project to project. I would like to automatically open,
update, save and then save as CSV file, but I have no idea how to set up a
macro to loop within an unknown path for future projects. The first part
of the path will always be "Y:\Yarger Engineering\" followed by the
project number and name, then "synchro", phase or year, maybe the day of
week but normally not since we normally don't worry about weekends, and
then the time of day. I may have an upcoming project where I will have to
do this 200 times, so I really don't want to have to do this manually any
more. In some cases, this will be creating the first CSV file and in
others it will overwrite an existing CSV file.

Brad

Excel 2002 on XP Pro SP 3