View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
doug doug is offline
external usenet poster
 
Posts: 2
Default Saving an Excel file as a CSV using a Macro

Thanks. Tried this but this simply closes the active
worksheet without saving it. I do need to overwrite the
existing csv file each time the macro is run.

The macro I had is as follows:

Range("A1").Select
Workbooks.Open Filename:= _ "Worksheet 2.csv"
Windows("API model Worksheet 1.xls").Activate
Range("A17").Select
Selection.Copy
Windows("Worksheet 2.csv").Activate
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=False
Range("A2").Select
Application.CutCopyMode = False
Workbooks("E9B.csv").Save
ActiveWindow.Close
Range("A1").Select

Answering Yes to the resulting pop up message(detailed
below) results in the SAVE AS box being displayed.

-----Original Message-----
The new CSV file you have saved, is actually open and
contains another information, that couldn't be saved on
the CSV file, that is why you are being asked , so to
avoid this message, I suggest you close the file with
the false option (for save)

activeworkbook.close false ' or whatever workbook you
' want to close

Francisco Mariscal
fcomariscal at hotmail dot com
-----Original Message-----
Hello,

I am trying to write a macro that copies a string of

data
from one spreadsheet into a second spreadsheet so that I
can save that string of data as a CSV file (which I am
then moving via ftp). When running the macro, I get the
pop up "Do you want to save the changes made to

aaa.csv?".
If the file was a .xls file, using the save function

would
simply overwrite the existing file - this obviously does
not happen when saving the spreadsheet in a different
format.
Does anyone know how I can get around this?

Many thanks
Doug
.

.