Saving files

  • Thread starter Thread starter Cindy
  • Start date Start date
C

Cindy

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.
 
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
 
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




--

Dave Peterson
(e-mail address removed)
.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top