[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


Save file with date and new name

Posted on 2011-10-26
Medium Priority
Last Modified: 2012-05-12
Need help on why I'm getting a compile error that state "

The result of the file name should be like

10/26/11 DWW NNNNN ABC#11111

Any thoughts?

Sub SaveWeeklyConstraintFile()
Application.DisplayAlerts = False

Workbooks.Open Filename:="C:\Users\abcde\Documents\Constraint File Upload\MM-DD-YY Weekly Dealer Constraints.xlsx"
ActiveWorkbook.SaveAs Filename:= _
"C:\Users\abcde\Documents\Constraint File Upload\Format(Now(), "mmm-dd-yyyy")" & "DWW NNNNN ABC#11111", FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False

ActiveWorkbook.Close False
'Call Workbook_Close
End Sub
Question by:mato01
1 Comment
LVL 43

Accepted Solution

Saqib Husain, Syed earned 500 total points
ID: 37032859

ActiveWorkbook.SaveAs Filename:= _
"C:\Users\abcde\Documents\Constraint File Upload\" & Format(Now(), "mmm-dd-yyyy") & "DWW NNNNN ABC#11111", FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question