+ Reply to Thread
Results 1 to 4 of 4

VBA to create a folder on a network drive before saving the file to it?

  1. #1
    Forum Contributor jonvanwyk's Avatar
    Join Date
    06-28-2010
    Location
    Iowa, USA
    MS-Off Ver
    Excel 2010
    Posts
    452

    VBA to create a folder on a network drive before saving the file to it?

    I am using the code below to convert worksheets into PDFs and then automatically save them to a specified location on a network drive. The code currently requires the folders [to which the PDFs are being saved] to already exist. What if I do not want to create the folders in advance? I built the workbook to be able to used for the next 20 years and I don't really feel like making 520 folders. Can I modify the macro to CREATE the folder if it does not already exist? In this case, when the button is pushed, it looks for the subfolder "070112 - 071412" within G:\Timesheets\PDF Archive\2013\ and saves the PDF to it. If the subfolder "070112 - 071412" is not already there, can the code create the folder and then save the PDF to it?

    Please Login or Register  to view this content.

  2. #2
    Forum Contributor
    Join Date
    12-28-2011
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    280

    Re: VBA to create a folder on a network drive before saving the file to it?

    You can check if a Folder exists:

    Please Login or Register  to view this content.

  3. #3
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: VBA to create a folder on a network drive before saving the file to it?

    Where will the code pick up the folder name from?
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  4. #4
    Forum Contributor jonvanwyk's Avatar
    Join Date
    06-28-2010
    Location
    Iowa, USA
    MS-Off Ver
    Excel 2010
    Posts
    452

    Re: VBA to create a folder on a network drive before saving the file to it?

    In this particular macro, the folder name would be derived from the date range located in cell "B20" located on worksheet "Menu", which in this case is "070112 - 071412".
    Last edited by jonvanwyk; 12-29-2011 at 11:10 AM.

+ 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