'Save As' in Excel

F

Friendly Indian

Greetings,

I would like to create an Excel file from within another file, I
want it to act like this. I want to open a specific file (we
will call it 'myfile') and from within 'myfile' I want to save
the current file as another called 'mynewdate' when the 'Save
As' is selceted from the File menu. I want the new file to use
the current date as a default file name in the format of
'/mmddyyyy'. So here is the scenario;open myfile, save as
(diaglog opens) mmddyyyy is already in filr name box. How can I
do this? Thanks

--

Please reply to newsgroup so we can all learn from you
knowledge.
Private emails will not be answered.

Friendly Indian
 
A

Andy

Take a look at the code, below:

The code uses the date and time format of "yyyyddmm_hhmmss". This ensures
that backup versions are listed in creation order when sorted by name. Bear
in mind that the date the backup is originally saved is not, necessarily,
the last time it was saved.

Code begins - - -

'' *************************************************
'' Purpose : Generate history
'' Written : 29-Oct-2000 by Andy Wiggins - Byg Software Ltd
''
Sub SaveBackup()
Const ctTitle = "Archive Save"
Dim lStr_NewName As String

lStr_NewName = ThisWorkbook.Path & "\" & ThisWorkbook.Name & " " &
Format(Now, "yyyymmdd_hhmmss")

With ThisWorkbook

If vbYes = MsgBox(lStr_NewName, vbYesNo + vbCritical, ctTitle) Then
.SaveCopyAs lStr_NewName
.Save
Else
MsgBox "Not saved", vbOKOnly + vbInformation, ctTitle
End If

End With

End Sub

Code ends - - -
--
Regards
Andy Wiggins
www.BygSoftware.com
Home of "Save and BackUp",
"The Excel Auditor" and "Byg Tools for VBA"
 
F

Friendly Indian

Thanks Andy,

Is there a way to then delete the code in the code window
(workbook.open)which is where I put it for the backed up file.
I do not wish an addiitional copy to be made from a copy when
that file is executed. Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top