Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default Save file close and reopen

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default Save file close and reopen

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

"Graham" skrev i meddelelsen
...
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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default Save file close and reopen

Many thanks for that Per, I really appreciate the help

Kind regards
Graham

Per Jessen wrote:
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

"Graham" skrev i meddelelsen
...
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


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default Save file close and reopen

Hi Graham

Thanks for your reply.

Best regards
Per

"Graham" skrev i meddelelsen
...
Many thanks for that Per, I really appreciate the help

Kind regards
Graham


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to show gridlines when I close & reopen without having to go Shorty Excel Discussion (Misc queries) 1 July 16th 06 10:44 PM
create chart /table excel-save, close & reopen colors change? Why Anne Charts and Charting in Excel 1 July 4th 06 09:16 PM
Close & save a file at set time only IF the file is open Clivey_UK[_5_] Excel Programming 2 May 1st 06 06:19 PM
Hyperlinks breaking when save/reopen file... taylorj Excel Discussion (Misc queries) 2 April 3rd 06 09:33 AM
Automate open file, update links, run macro, close and save file Geoff[_7_] Excel Programming 2 August 26th 03 10:13 PM


All times are GMT +1. The time now is 01:20 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"