Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Save one worksheet from a workbook to a new .csv file
Hi,
In code, how can I save one specific worksheet from a workbook with many worksheets to a new .csv file. I've looked at the SaveAs Method in Help but I don't see the answer there. Any help would be appreciated. -- Thanks. Chuck M. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Save one worksheet from a workbook to a new .csv file
Hi Chuck
Try this for the activesheet Sub ActiveSheet_CSV_File() Dim wb As Workbook Dim strdate As String Dim Fname As String strdate = Format(Now, "dd-mmm-yy h-mm-ss") Fname = "C:\Part of " & ThisWorkbook.Name _ & " " & strdate & ".csv" Application.ScreenUpdating = False ActiveSheet.Copy Set wb = ActiveWorkbook With wb .SaveAs Fname, FileFormat:=xlCSV .Close False End With Application.ScreenUpdating = True End Sub -- Regards Ron de Bruin http://www.rondebruin.nl "Chuck M" wrote in message ... Hi, In code, how can I save one specific worksheet from a workbook with many worksheets to a new .csv file. I've looked at the SaveAs Method in Help but I don't see the answer there. Any help would be appreciated. -- Thanks. Chuck M. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Save one worksheet from a workbook to a new .csv file
Hi Ron,
That works perfectly. Thanks for the quick response. -- Thanks. Chuck M. "Ron de Bruin" wrote: Hi Chuck Try this for the activesheet Sub ActiveSheet_CSV_File() Dim wb As Workbook Dim strdate As String Dim Fname As String strdate = Format(Now, "dd-mmm-yy h-mm-ss") Fname = "C:\Part of " & ThisWorkbook.Name _ & " " & strdate & ".csv" Application.ScreenUpdating = False ActiveSheet.Copy Set wb = ActiveWorkbook With wb .SaveAs Fname, FileFormat:=xlCSV .Close False End With Application.ScreenUpdating = True End Sub -- Regards Ron de Bruin http://www.rondebruin.nl "Chuck M" wrote in message ... Hi, In code, how can I save one specific worksheet from a workbook with many worksheets to a new .csv file. I've looked at the SaveAs Method in Help but I don't see the answer there. Any help would be appreciated. -- Thanks. Chuck M. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I save a worksheet within a workbook? | Excel Discussion (Misc queries) | |||
Save worksheet vs workbook | Excel Programming | |||
Save Every Worksheet as its own Workbook | Excel Programming | |||
Save Workbook or worksheet | Excel Programming | |||
save worksheet as new workbook | Excel Programming |