+ Reply to Thread
Results 1 to 7 of 7

Adapting Existing Code to Offer Option to Save to Existing Folder

  1. #1
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,719

    Adapting Existing Code to Offer Option to Save to Existing Folder

    Good morning, all!

    I have the following code snippet in a longer piece of code developed with your help:

    Please Login or Register  to view this content.
    It creates a folder in which to deposit one or more worksheets from the master workbook. What I would like to do is to add a checkbox to my user form (this bit I can do) that, when checked, will override the above section of code and instead ask the user to browse to an existing folder. Ideally I'd need this to happen at the start of the routine so that it only has to be done once, and not for each sheet generated. If it's not easy to do, I can live without it, but it would be a nice refinement.

    To put this in context, here's the complete code:

    Please Login or Register  to view this content.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  2. #2
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Adapting Existing Code to Offer Option to Save to Existing Folder

    This section
    Please Login or Register  to view this content.
    replaces
    Please Login or Register  to view this content.
    How it works.

    Assuming your CheckBox is Named CheckBox1. When checked Folderpicker opens to select a folder. FolderName will be the one you select.

    If you should click Cancel in Folderpicker default FolderName will be intiated.

    If CheckBox is not checked default folderName will be initiated.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  3. #3
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,719

    Re: Adapting Existing Code to Offer Option to Save to Existing Folder

    Thank you, Rudi - this seems pretty straightforward. I shall give it a go and let you know how it goes.

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,719

    Re: Adapting Existing Code to Offer Option to Save to Existing Folder

    Works great, thanks!

    Is there a way to make the Shell.Application default to this folder in the folder browser: C:\Users\Alison\OneDrive - Royal Hospital School\Documents\Timetable WIP\2019-20\

  5. #5
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Adapting Existing Code to Offer Option to Save to Existing Folder

    Try this.
    Please Login or Register  to view this content.

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,719

    Re: Adapting Existing Code to Offer Option to Save to Existing Folder

    Perfect. Thanks again!

  7. #7
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Adapting Existing Code to Offer Option to Save to Existing Folder

    Glad to help and thanks for rep+. Much appreciated.

+ 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. Adapting this existing formula with less variables?
    By Weaselwithagun in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-18-2019, 11:21 AM
  2. [SOLVED] Adapting Existing Formulas to Changing Months
    By vill in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-07-2017, 08:36 AM
  3. update existing code to copy and KEEP existing data
    By scott micklo in forum Excel Programming / VBA / Macros
    Replies: 20
    Last Post: 01-26-2016, 05:41 PM
  4. [SOLVED] Save copy to newly created directory in the existing folder structure
    By wpryan in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-28-2015, 04:20 AM
  5. [SOLVED] Correct way to apply an existing VBA code to an existing sheet
    By JO505 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-05-2013, 05:42 PM
  6. Replies: 1
    Last Post: 08-15-2009, 05:52 AM
  7. Help adapting an existing macro.
    By paul1970 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-10-2008, 09:50 AM

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