Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old July 11th, 2007, 02:00 AM
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
Reply With Quote
  #2 (permalink)  
Old July 11th, 2007, 03:05 AM
Friend of Wrox
Points: 2,950, Level: 22
Points: 2,950, Level: 22 Points: 2,950, Level: 22 Points: 2,950, Level: 22
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2005
Location: , , .
Posts: 788
Thanks: 1
Thanked 51 Times in 47 Posts
Default

Just Disable the Alerts and proceed.. You will get it

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

Application.DisplayAlerts = True

Cheers
Shasur

http://www.dotnetdud.blogspot.com
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Read CSV file - Save Columns into Rows pintoo BOOK: Professional SQL Server 2005 Integration Services ISBN: 0-7645-8435-9 1 August 20th, 2008 09:01 AM
Change excel into csv format Ivanchan Excel VBA 4 July 5th, 2007 02:02 AM
Unable to save Excel with macro on server guptasourav Classic ASP Basics 0 January 17th, 2007 04:21 AM
save as CSV file cdsniti Java Databases 1 December 21st, 2005 06:26 AM
save file in csv, txt format in jsp URGENT ernidhi2003 JSP Basics 1 October 14th, 2004 04:59 PM



All times are GMT -4. The time now is 12:49 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.