View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
NickHK[_3_] NickHK[_3_] is offline
external usenet poster
 
Posts: 415
Default writing excel macros

Make a back up of your original file first, then replace your code with
this.
Does this achieve your aim ?

Sub Save_EF_as_csv()
Dim RetVal As Variant

Sheets("Electronic File").Copy
RetVal = Application.GetSaveAsFilename(, "CSV File (*.csv),*.csv", , "Select
a file name and location")
If RetVal = False Then Exit Sub

ActiveWorkbook.SaveAs RetVal, xlCSV
ActiveWorkbook.Close False

Sheets("Print File").Select
End Sub

NickHK

"TMiGNa" ...
"NickHK" wrote:

Post what you have at the moment, as long as it's not pages long.

NickHK

-----------------------------------------------------------------------------------------

Sub Save_EF_as_csv()
'
' Save_EF_as_csv Macro
' Macro recorded 2/4/2005 by KClifford
'

Sheets("Electronic File").Select
Cells.Select
Selection.Copy
Workbooks.Add
Selection.PasteSpecial Paste:=xlFormats, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=False
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:=
_
False, Transpose:=False
ActiveWorkbook.SaveAs Filename:=Application.GetSaveAsFilename(""),
FileFormat:= _
xlCSV
ActiveWindow.Close , SaveChanges:=False
Sheets("Print File").Select
End Sub