• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Excel VBA - Create .csv file from Worksheet

brxndxn

Diamond Member
I would like to create a button in Excel that saves a worksheet in the same Excel workbook named "Worksheet1" to a csv file. I also want it to prompt for the filename and location..

What is a nice pretty way to do this?

I'm not the best at creating new VBA scripts, but I can understand them..
 
Can't Excel already do this from the File -> Save option (select .csv as the file type)?
 
Originally posted by: drebo
Yeah, File->Save As..., set type to .csv.

I want to do this from a button I imbed in the worksheet... Click the button and instantly c:\output.csv appears.. while the current xls file stays open..

 
Try recording a macro of yourself saving it as a CSV file. In Office 2007 it creates this code:

ActiveWorkbook.SaveAs Filename:="C:\Users\Aaron\Documents\Book1.csv", _
FileFormat:=xlCSV, CreateBackup:=False

I'm assuming you know how to create the button and make it work so i'll stop here.
 
Back
Top