Thread: Save AS
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Andy Wiggins Andy Wiggins is offline
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.