Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Greg B
 
Posts: n/a
Default Saving into new directory

Hi Want to save workbooks into archive when finished with i went through the
manual mode and would like to know, What do I have to change in this code so
it keeps the current file name etc greg.xls so on and so on.


ChDir "C:\idsc\archived"
ActiveWorkbook.SaveAs Filename:="C:\idsc\archived\Book1.xls",
FileFormat:= _
xlNormal, Password:="", WriteResPassword:="",
ReadOnlyRecommended:=False _
, CreateBackup:=False
Range("G3").Select
End Sub
\

Thanks in advance

Greg


  #2   Report Post  
Dave O
 
Posts: n/a
Default

Right after the Sub( ) line at the top, add this line to declare a
variable that holds your workbook name:

Dim CurrentFileName as string
CurrentFileName = activeworkbook.name

Then change
ActiveWorkbook.SaveAs Filename:="C:\idsc\archived\Book1.xls",

.... to this:
ActiveWorkbook.SaveAs Filename:="C:\idsc\archived\" & CurrentFileName,


Note this changes your default directory to C:\IDSC\Archived, and the
active sheet, now on your screen, is your archive copy. This leaves
you open to inadvertently changing your archive copy, or treating it as
your main version. If that's not OK, let us know and we can add code
to get it to work to your specifications.

  #3   Report Post  
Greg B
 
Posts: n/a
Default

Thanks for that works great


Greg


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
change directory for refresh data TxRaistlin Excel Discussion (Misc queries) 0 February 7th 05 09:09 PM
Saving shared Excel files scasawyer New Users to Excel 3 February 7th 05 02:21 PM
How do I insert the directory path in my Excel file? Insert a Directory Path in Header/Footer Excel Worksheet Functions 2 February 4th 05 09:23 PM
Opening and saving Excel 2003 file from Excel 97. Rodrigo Excel Discussion (Misc queries) 2 December 12th 04 02:17 PM
Error Message appearing when saving a file JaneC Excel Discussion (Misc queries) 0 November 25th 04 10:35 PM


All times are GMT +1. The time now is 02:32 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"