Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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
.

.

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

Well that happens when you don't provide enough
information.

if the instruction that is making that message (You can
check if you debug your code step by step)
is:
ActiveWindow.Close
then replace it for:
ActiveWorkbook.close false
but you previously save the file

if your problem is that some times your file already exist
on disk then you can delete it previous to the save
command with:
on error resume next
kill "E9B.csv"
Workbooks("E9B.csv").Save



Francisco Mariscal
fcomariscal at hotmail dot com

-----Original Message-----
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
.

.

.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Saving an Excel file as a CSV using a Macro

Just a note to say thanks.

Got it sorted, but couldn't have done it without your
input.

Regards
Doug
-----Original Message-----
Well that happens when you don't provide enough
information.

if the instruction that is making that message (You can
check if you debug your code step by step)
is:
ActiveWindow.Close
then replace it for:
ActiveWorkbook.close false
but you previously save the file

if your problem is that some times your file already

exist
on disk then you can delete it previous to the save
command with:
on error resume next
kill "E9B.csv"
Workbooks("E9B.csv").Save



Francisco Mariscal
fcomariscal at hotmail dot com

-----Original Message-----
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
.

.

.

.

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
Excel 2007: Saving a file with a Macro Gary Excel Discussion (Misc queries) 1 April 28th 10 03:13 PM
Saving a file while recording a macro Richard Champlin Excel Discussion (Misc queries) 6 September 1st 07 01:08 AM
Saving a copy of excel file in macro but have it auto write pano Excel Worksheet Functions 4 March 27th 07 11:54 PM
Macro Help for Saving a file [email protected] Excel Worksheet Functions 3 May 12th 06 05:16 PM
Saving a new file with a macro Mike[_36_] Excel Programming 0 July 23rd 03 03:55 PM


All times are GMT +1. The time now is 06:48 PM.

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

About Us

"It's about Microsoft Excel"