Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Saving files
I have a workbook that has a macro that does a save as
saves a csv file. The problem is that until you close the file and re-open it, it still has formuals, multiple worksheets, etc in it. For my purposes, I need the file to be a true csv file. Is there a way to do a file save as and close that file with out closing the current excel file. OR save the current file as an excel file then save as again as a csv file then open the excel file and close the csv file. To complicate it more the file is opened originally as a read only and I would have to come up with some type of name for the save. Any help will be greatly appreciated. Cindy. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Saving files
Are you sure you're opening the .csv file the second time?
Try it with a nice unique name--just to verify. I'm not sure what your macro does, but if you copy the worksheet to a new workbook, then save that, it might work better for you: Option Explicit Sub testme01() Dim wks As Worksheet Set wks = Worksheets("sheet1") wks.Copy 'to a new workbook With ActiveSheet.Parent .SaveAs Filename:="whateveryousaveitas.CSV", FileFormat:=xlCSV .Close savechanges:=False End With Workbooks.Open Filename:="whateveryousaveitas.CSV" End Sub Cindy wrote: I have a workbook that has a macro that does a save as saves a csv file. The problem is that until you close the file and re-open it, it still has formuals, multiple worksheets, etc in it. For my purposes, I need the file to be a true csv file. Is there a way to do a file save as and close that file with out closing the current excel file. OR save the current file as an excel file then save as again as a csv file then open the excel file and close the csv file. To complicate it more the file is opened originally as a read only and I would have to come up with some type of name for the save. Any help will be greatly appreciated. Cindy. -- Dave Peterson |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Saving files
Dave, Thanks for the help.
-----Original Message----- Are you sure you're opening the .csv file the second time? Try it with a nice unique name--just to verify. I'm not sure what your macro does, but if you copy the worksheet to a new workbook, then save that, it might work better for you: Option Explicit Sub testme01() Dim wks As Worksheet Set wks = Worksheets("sheet1") wks.Copy 'to a new workbook With ActiveSheet.Parent .SaveAs Filename:="whateveryousaveitas.CSV", FileFormat:=xlCSV .Close savechanges:=False End With Workbooks.Open Filename:="whateveryousaveitas.CSV" End Sub Cindy wrote: I have a workbook that has a macro that does a save as saves a csv file. The problem is that until you close the file and re-open it, it still has formuals, multiple worksheets, etc in it. For my purposes, I need the file to be a true csv file. Is there a way to do a file save as and close that file with out closing the current excel file. OR save the current file as an excel file then save as again as a csv file then open the excel file and close the csv file. To complicate it more the file is opened originally as a read only and I would have to come up with some type of name for the save. Any help will be greatly appreciated. Cindy. -- Dave Peterson . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Saving Files | New Users to Excel | |||
Saving files | Excel Discussion (Misc queries) | |||
Help - saving files | Excel Worksheet Functions | |||
Closing files and saving files | Excel Worksheet Functions | |||
Saving csv files | Excel Discussion (Misc queries) |