ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   File Save As through VBA (https://www.excelbanter.com/excel-programming/365540-file-save-through-vba.html)

[email protected]

File Save As through VBA
 
I have a command button in my excel file after clicking on which it
does some calculations.

I need a small piece of code at the end of my code which will save a
copy of that file (Save As) in C:\ with the current date and time (eg.
xxx06271315.xls) 0627 is the date 27th June and 1315 is the time 1:15
PM

Can anybody help?


Chip Pearson

File Save As through VBA
 
Try


ThisWorkbook.SaveAs Filename:= _
"C:\" & Format(Now, "mmddhhmm") & ".xls"


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



wrote in message
oups.com...
I have a command button in my excel file after clicking on which
it
does some calculations.

I need a small piece of code at the end of my code which will
save a
copy of that file (Save As) in C:\ with the current date and
time (eg.
xxx06271315.xls) 0627 is the date 27th June and 1315 is the
time 1:15
PM

Can anybody help?





All times are GMT +1. The time now is 06:21 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com