Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Greetings:
I have a VBA routine that saves each worksheet in the active workbook as a ..csv file. When finished, I want the original workbook to be active, with its original name. In order to accomplish this, I must end the routine by saving the workbook one more time, using its its original name. This is undesirable as the user may wish to save the sneets but not save the whole workbook. Here is the code for the routine ######### Sub saveallCSV() Dim Fname As String Dim OrigFname As String Dim Fpath As String Dim sht As Worksheet OrigFname = ActiveWorkbook.Name Fpath = ActiveWorkbook.Path Application.ScreenUpdating = False Application.DisplayAlerts = False For Each sht In Sheets Fname = Fpath + "\" + sht.Name + ".csv" sht.SaveAs Fname, FileFormat:=xlCSV Next sht Fname = Fpath + "\" + OrigFname ActiveWorkbook.SaveAs Fname, FileFormat:=xlWorkbookNormal Application.DisplayAlerts = True Application.ScreenUpdating = True End Sub ######### How can I eliminate the last save and still return to the original workbook? Thanks in advance for your help. Barry Carroll PSC Scanning -- (Cleverly disguised as a responsible adult) --------- PSC Scanning, Inc. assumes no responsibility whatsoever for any statements made by me. I''m entirely on my own. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Loop not returning to original workbook | Excel Programming | |||
saving multiple sheets in a workbook | Excel Discussion (Misc queries) | |||
Copy tabs(sheets) from workbook without link to original source | Excel Discussion (Misc queries) | |||
Copy tabs(sheets) from workbook without link to original source | Links and Linking in Excel | |||
Returning to original workbook | Excel Programming |