+ Reply to Thread
Results 1 to 2 of 2

Creating a VBA Script to save in a current month's folder (create folder as needed)

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    09-01-2013
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, Excel 2013, Excel 2016
    Posts
    115

    Creating a VBA Script to save in a current month's folder (create folder as needed)

    Hi All,

    I need some help with writing a VBA script in excel to do the following save file function

    1. the filename will have the following format "Cable SVL Page " & Format(Now, "mmmm dd, yyyy") & ".xlsm"
    2. The file will run from it's current location but will save as the above filename and format in a different location.
    3. The location to be saved in is "B:\NCC\ntsd\cable\" but the file will need to look for the current months' folder and save itself there.
    4. If the current months' folder does not exist it will need to be created before saving. The format of the month is just the full name of the month e.g. November.

    Any help will be appreciated.

  2. #2
    Forum Contributor
    Join Date
    09-01-2013
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, Excel 2013, Excel 2016
    Posts
    115

    Re: Creating a VBA Script to save in a current month's folder (create folder as needed)

    Closing the thread as I found a solution

    Dim folder As String 
     
    folder = "B:\NCC\ntsd\cable\" & Format(Date, "mmmm") & "\" 
    On Error Resume Next 
    MkDir folder 
    On Error GoTo 0 
    With ActiveWorkbook 
         
        .SaveAs Filename:=folder & .Name 
    End With

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] How do I save to a folder that is the current month and have it save to next month"
    By shikano53 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 07-16-2014, 03:56 PM
  2. How to save file in respective month folder as per current year vba modification
    By KK1234 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-03-2014, 05:26 PM
  3. [SOLVED] VBA to save a workbook to a folder but create that folder if it doesn't already exist
    By cnixon in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-24-2014, 06:01 PM
  4. Code to create New Folder (if doesn't exist) and then Save Workbook to folder
    By jenhawley in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 01-10-2013, 03:09 PM
  5. Save a file to a folder, create folder if it doesn't exist
    By mcinnes01 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-01-2010, 09:12 AM
  6. Create Folder with system date then save file to folder
    By cartotech81 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-06-2009, 02:12 PM
  7. Replies: 6
    Last Post: 08-11-2006, 03:41 PM

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