Save file with date and new name

Posted on 2011-10-26
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


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

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Suggested Solutions

    When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
    Article by: Martin
    Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
    The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
    The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

    760 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

    Need Help in Real-Time?

    Connect with top rated Experts

    7 Experts available now in Live!

    Get 1:1 Help Now