Save As Date and Time

K

K1KKKA

Hi all,

Am using the code below to count how many times the 'CmdAdd' button is
pressed, when it has reached the target of 6 i would like to save the
workbook into a temporary file, this bit works but i would like the
file name to be the time and date for the save as this would then not
overwrite previous saves. is this possible using the code below....

Was hoping maybe the 'format Now()' would be possible, but have had no
success with this

HYCH

Static ClickCtr As Long
ClickCtr = ClickCtr + 1
If ClickCtr = 6 Then
ClickCtr = 0
MsgBox "Click OK to Save this File Now "
ActiveWorkbook.SaveCopyAs "c:\goods\"
End If



Steve
 
J

JE McGimpsey

This works for me:

Const sPATH As String = "<your path>"
Static ClickCtr As Long
ClickCtr = ClickCtr + 1
If ClickCtr = 6 Then
ClickCtr = 0
MsgBox "Click OK to Save this File Now "
ActiveWorkbook.SaveCopyAs sPATH & _
Format(Now, "yyyymmddhhmmss") & ".xls"
End If
 
K

K1KKKA

This works for me:

Const sPATH As String = "<your path>"
Static ClickCtr As Long
ClickCtr = ClickCtr + 1
If ClickCtr = 6 Then
ClickCtr = 0
MsgBox "Click OK to Save this File Now "
ActiveWorkbook.SaveCopyAs sPATH & _
Format(Now, "yyyymmddhhmmss") & ".xls"
End If






- Show quoted text -

Exactly what i was after,

many thanks

Steve
 
Top