View Single Post
  #1 (permalink)  
Old July 11th, 2007, 02:00 AM
roli2712 roli2712 is offline
Registered User
 
Join Date: Jul 2007
Location: , , India.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Save a file in CSV format thru Excel VBA macro

hi
i need some help
i have to copy a sheet from my working excel file and paste it in new file and thn save the file as csv (Comma Delimited) file..
while doing so,even though i m saving the file, i m once again prompted by the message "that do you want to save the changes you made.." whereby i have to click yes...

can this be done thru macro directly????????

the code i have written is as under:
where,
Sheet_Name is the shhet i want to paste
filename1 is the name by which i want to save the new file
oldfilename is the existing excel file where the macro is to b written

     Application.Sheets(Sheet_Name).Select
     Application.Sheets(Sheet_Name).Copy
     ActiveWorkbook.SaveAs Filename:=filename1, FileFormat:=xlCSV, _
     CreateBackup:=False
     ActiveWorkbook.Save
     ActiveWindow.Close
     Windows(oldfilename).Activate