billandrew

Well-known Member
Joined
Mar 9, 2014
Messages
743
Good afternoon

Is there a way to insert the Month Day Year Hour & Minute combined with the "Results" file.

Thanks guys....

Code:
Dim wb As Workbook
Dim filename As String
Set wb = Workbooks.Add
ThisWorkbook.Activate
ActiveSheet.Copy before:=wb.Sheets(1)
wb.Activate
filepath = CreateObject("WScript.Shell").SpecialFolders("Desktop") & Application.PathSeparator
wb.SaveAs filepath & Format(Now, "mm dd yy HH:mm") & ".xlsx", FileFormat:=51
 
wb.SaveAs filepath & "Results" & ".xlsx", FileFormat:=51
 
Last edited:

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Hi,
Try swapping your two wb.save lines with the following one and let me know of that's what you're looking for.

Code:
wb.SaveAs filepath & "Results" & cstr(now()) & ".xlsx"
Regards,
Sebastian
 
Upvote 0
Managed to work it out with the below.

Thank You

Code:
wb.SaveAs filepath & "Results" & " " & Format(Now, "mm-dd-yy hhmm") & ".xlsx", FileFormat:=51

Also discovered my string variable was incorrectly entered....
 
Upvote 0

Forum statistics

Threads
1,214,929
Messages
6,122,317
Members
449,081
Latest member
tanurai

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top