+ Reply to Thread
Results 1 to 10 of 10

Sequential File Name Auto Creation?

  1. #1
    Forum Contributor
    Join Date
    06-17-2010
    Location
    Leicester
    MS-Off Ver
    Excel 2010
    Posts
    119

    Sequential File Name Auto Creation?

    Kind of a lazy question here, but would save time in the long run.

    At the start of every month I need to create a daily excel spreadsheet for each day in that month.

    For example Diff.010311.xls
    Diff.020311.xls

    Etc etc.

    Is there a way I can create one, and get excel to automatically create the others with sequential file names.

    Hope that makes sense.

    Understand might not be possible.
    Last edited by dshilan; 03-17-2011 at 05:33 AM.

  2. #2
    Valued Forum Contributor Sadath31's Avatar
    Join Date
    03-02-2011
    Location
    Dammam, Saudi Arabia
    MS-Off Ver
    Office 365
    Posts
    452

    Re: Sequential File Name Auto Creation?

    if you want to create a blank file, this will do
    Sub CreateFile()
    For x = 1 To 31
    Workbooks.Add
    ChDir "C:\Documents and Settings\sadat\My Documents" ' give the correct path here
    ActiveWorkbook.SaveAs Filename:=Format(x, "00") & Format(Month(Date), "00") & "11.xls"
    ActiveWorkbook.Close
    Next

    End Sub

  3. #3
    Forum Contributor
    Join Date
    06-17-2010
    Location
    Leicester
    MS-Off Ver
    Excel 2010
    Posts
    119

    Re: Sequential File Name Auto Creation?

    Thanks Sadath, thats excellent.

    How can I run this for a template that already has some macros.

    Attached file.
    Attached Files Attached Files

  4. #4
    Valued Forum Contributor Sadath31's Avatar
    Join Date
    03-02-2011
    Location
    Dammam, Saudi Arabia
    MS-Off Ver
    Office 365
    Posts
    452

    Re: Sequential File Name Auto Creation?

    run CreateFile macro
    Attached Files Attached Files

  5. #5
    Forum Contributor
    Join Date
    06-17-2010
    Location
    Leicester
    MS-Off Ver
    Excel 2010
    Posts
    119

    Re: Sequential File Name Auto Creation?

    Sadath 31, think we are getting close, but this doesnt quite work.

    When I run

    Please Login or Register  to view this content.
    It does create the new document for example RJ_Diff_010311, but then 020311 overwrites this, I would like 31 brand new seperate workbooks, all from the same template.

    Does this make sense?

    Dan.

  6. #6
    Forum Contributor Charlie_Howell's Avatar
    Join Date
    09-27-2010
    Location
    Memphis, TN
    MS-Off Ver
    Excel 2007
    Posts
    218

    Re: Sequential File Name Auto Creation?

    how would you run this code to save as "xlsx" ?

  7. #7
    Forum Contributor Charlie_Howell's Avatar
    Join Date
    09-27-2010
    Location
    Memphis, TN
    MS-Off Ver
    Excel 2007
    Posts
    218

    Re: Sequential File Name Auto Creation?

    @dshilan
    Sub CreateFile()
    For x = 1 To 31
    ActiveWorkbook.SaveAs Filename:="RJ_Diff_" & Format(x, "00-") & Format(Month(Date), "00-") & "11.xls"

    Next

    End Sub

  8. #8
    Forum Contributor
    Join Date
    06-17-2010
    Location
    Leicester
    MS-Off Ver
    Excel 2010
    Posts
    119

    Re: Sequential File Name Auto Creation?

    Charlie that works perfectly.

    Seems to save the files into my P:\

    How can I specify them to generate in particular folder?

    Thanks.

  9. #9
    Forum Contributor Charlie_Howell's Avatar
    Join Date
    09-27-2010
    Location
    Memphis, TN
    MS-Off Ver
    Excel 2007
    Posts
    218

    Re: Sequential File Name Auto Creation?

    Hi, no problem, i use Office 2007 so im not sure how or where all the save settings are in 2003.
    That being said, I go into excel options and find "Save" and tell it where I want all of my sheets to be saved by changing the destination path. Again Im not sure how 2003 is laid out.Message me back and let me know what you find and how. Ciao!
    Last edited by Charlie_Howell; 03-16-2011 at 05:04 PM.

  10. #10
    Forum Contributor
    Join Date
    06-17-2010
    Location
    Leicester
    MS-Off Ver
    Excel 2010
    Posts
    119

    Re: Sequential File Name Auto Creation?

    Go to Tools>Options>General

    In Default File Location field: copy and paste where you want files to go

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1