
07-14-2012, 07:13 AM
|
|
Regular
|
|
Join Date: Mar 2009
Posts: 50
|
|
Save as .csv file
|
I am trying to write a macro to save each worksheet as a separate .csv file. The file name of the csv file needs to come from cell Z1 of each worksheet, but I am running into some problems, what I think should work, isn't (which is the case in so many aspects of my life!). Here is what I have, any ideas?
Code:
Sub SaveAsCSV()
Dim FName As String
Dim FPath As String
FPath = "C:\Users\ben.griggs\Dropbox\BBP\Pricing Sheets\Converted Database Pricing Tables\"
FName = ActiveSheet.Range("Z1").Text
ActiveWorkbook.SaveAs Filename:=FPath & FName & ".csv", FileFormat:=xlCSVMSDOS
End Sub
Thanks in advance.
|
|