#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
MCH MCH is offline
external usenet poster
 
Posts: 1
Default Save AS

I have a Macro button which is used every month to do a SAVE AS the problem
is I have to go in the macro every month and change to the current month,
Does any one know of a way to get the macro to change the month.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 107
Default Save AS

Sample saving routines can be found he
http://www.bygsoftware.com/Excel/VBA/saving.htm

From htat page, here's an example of something that might help you:

''
************************************************** *************************
'' Purpose : Create backup at month end
'' Written : 08-Jul-2004 by Andy Wiggins - Byg Software Ltd
''
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim lDat_Today As Date
Dim lDat_Tomorrow As Date
Dim lStr_TargetFile As String
lDat_Today = Date

If "Fri" = Format(Date, "ddd") Then
lDat_Tomorrow = Date + 3
Else
lDat_Tomorrow = Date + 1
End If With ThisWorkbook
If Month(lDat_Today) = Month(lDat_Tomorrow) Then
'' Do nothing, we're still in the same month
Else
'' Tomorrow is a new month so make a backup today
.SaveCopyAs ThisWorkbook.Path & "\" & _
Left(ThisWorkbook.Name, _
InStr(1, LCase(ThisWorkbook.Name), ".xls") - 1) & _
" - " & Format(Now, "yyyymmdd") & ".xls"
End If
'' Save the original
.Save
End With
End Sub-- Andy Wiggins FCCAwww.BygSoftware.comExcel, Access and VBA
Consultancy -"MCH" wrote in message
...
I have a Macro button which is used every month to do a SAVE AS the problem
is I have to go in the macro every month and change to the current month,
Does any one know of a way to get the macro to change the month.



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 296
Default Save AS

On Fri, 13 Oct 2006 21:39:02 -0700, MCH
wrote:

I have a Macro button which is used every month to do a SAVE AS the problem
is I have to go in the macro every month and change to the current month,
Does any one know of a way to get the macro to change the month.


The technique I usually use in a case like this is to hold the month
number or name in a named range variable, and use this variable within
the macro code which saves the filename.

Typically month numbers or names appear somwhere in data sheets or
reports anyway, so it's usually just a matter of naming the
appropriate cells. Or better still keeping all your variable names,
like month number etc., in once place, and having them refer to
specific cells.

HTH

__
Richard Buttrey
Grappenhall, Cheshire, UK
__________________________
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
Cannot save excel files to a folder on a network Robbie Excel Discussion (Misc queries) 1 June 9th 06 07:26 AM
macro save a workbook whilst increasing file no shrek Excel Worksheet Functions 0 November 10th 05 02:40 PM
Save as Msg box monster Excel Discussion (Misc queries) 3 August 31st 05 06:45 PM
Save as Msg box Bob Umlas, Excel MVP Excel Discussion (Misc queries) 0 August 29th 05 09:56 PM
Save & Save As features in file menu of Excel Blue Excel Discussion (Misc queries) 9 December 27th 04 08:49 PM


All times are GMT +1. The time now is 07:22 AM.

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

About Us

"It's about Microsoft Excel"