Save file close and reopen

  • Thread starter Thread starter Graham
  • Start date Start date
G

Graham

I have a workbook with several procedures which work on other files that I open. ie there
are no procedures within the workbooks that are opened but the "resident" workbook stays
open and contains them all. The files that are opened are csv files which are then edited
using the procedures and re-saved. What I need to do is create a procedure where the csv
file is saved using something like the line below to open the save-as window so the user
can choose a file name, then I need to close the csv file, open exactly the same file
again and save it, leaving the file open this time. Thus in short, save csv file, close
file, open same file and save it again. I no this sounds a bit convoluted but
unfortunately it is necessary. After the save as I have got lost on how close and open the
same file again and save I would value any guidance.

Application.GetSaveAsFilename ("*.csv")

Kind Regards,

Graham
Turriff
Scotland
 
Hi Graham

Try this

Dim MyFileName As String
MyFileName = Application.GetSaveAsFilename(fileFilter:=".csv (*.csv),
*.csv")
ActiveWorkbook.SaveAs (MyFileName)
ActiveWorkbook.Close
Workbooks.Open (MyFileName)
ActiveWorkbook.Save

Regards,

Per
 

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