#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 46
Default Automatic Save As

What I would like is a macro that onclosing my workbook asks for a date to be
entered by means of an inputbox in ddmmyy format and then automatically saves
the workbook as C:\docs\"form-ddmmyy". Any help would be greatly appreciated.
--
Al
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,101
Default Automatic Save As

This might not be what you are looking for but try it and let me know
Copy and paste this into the ThisWorkbook module

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim fname As Variant
Dim Wb As Workbook
Set Wb = ActiveWorkbook

Again:
fname = Application.GetSaveAsFilename(Format(Now(), "[$-409]mmddyy;@"), _
fileFilter:="Excel Files (*.xls), *.xls")

If fname = False Then Exit Sub
If Dir(fname) < "" Then MsgBox "File name already exist select a new name",
vbOKOnly
If Dir(fname) < "" Then GoTo Again


Wb.SaveCopyAs fname
End Sub
"gramps" wrote:

What I would like is a macro that onclosing my workbook asks for a date to be
entered by means of an inputbox in ddmmyy format and then automatically saves
the workbook as C:\docs\"form-ddmmyy". Any help would be greatly appreciated.
--
Al

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 46
Default Automatic Save As

Thanks Mike but it is not quite what I'm after. What I need is a macro that
when the workbook is closed it opens an input box which asks you to enter a
date. When this is entered it becomes part of the filename and so the path
that is created and saved as C:\docs\report-ddmmyy. This same report is saved
on a daily basis and is therefore distinguihed by the new date.
Thanks again
--
Al


"Mike" wrote:

This might not be what you are looking for but try it and let me know
Copy and paste this into the ThisWorkbook module

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim fname As Variant
Dim Wb As Workbook
Set Wb = ActiveWorkbook

Again:
fname = Application.GetSaveAsFilename(Format(Now(), "[$-409]mmddyy;@"), _
fileFilter:="Excel Files (*.xls), *.xls")

If fname = False Then Exit Sub
If Dir(fname) < "" Then MsgBox "File name already exist select a new name",
vbOKOnly
If Dir(fname) < "" Then GoTo Again


Wb.SaveCopyAs fname
End Sub
"gramps" wrote:

What I would like is a macro that onclosing my workbook asks for a date to be
entered by means of an inputbox in ddmmyy format and then automatically saves
the workbook as C:\docs\"form-ddmmyy". Any help would be greatly appreciated.
--
Al

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
Excel Automatic Calculation Options will not Save SMA1974 Setting up and Configuration of Excel 1 December 29th 06 08:42 PM
Automatic Save and Exit duane Excel Discussion (Misc queries) 1 July 18th 06 10:32 AM
Automatic save workbook rufusf Excel Worksheet Functions 0 March 22nd 06 07:49 AM
How do I set interval for automatic save? (not auto recovery) dee Excel Discussion (Misc queries) 3 August 30th 05 07:15 PM
How do you turn off automatic "save a copy" in Excel Cecilia Quinn Dean Excel Discussion (Misc queries) 2 May 22nd 05 06:43 PM


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