+ Reply to Thread
Results 1 to 8 of 8

Delete workbooks with specific prefix in its name

  1. #1
    Registered User
    Join Date
    12-22-2013
    Location
    Delhi, India
    MS-Off Ver
    Excel 2010
    Posts
    47

    Delete workbooks with specific prefix in its name

    Hi friends,

    I have a small question, is it possible to close and delete open workbook with some specific prefix in the file name.

    Suppose i have 4 open workbooks, say Workbook 1, Data 2, Data 3 (Number will keep on changing), RawData 4

    Now from Workbook 1, i want to close and delete the second and third workbook with file name prefix "Data" (The numerical values will keep on changing so i cant give the full workbook name to close and delete).

    Please let me know if it is possible and how.


    Thanks & Regards

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Delete workbooks with specific prefix in its name

    Check this out:http://www.mrexcel.com/forum/excel-q...lications.html
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Registered User
    Join Date
    12-22-2013
    Location
    Delhi, India
    MS-Off Ver
    Excel 2010
    Posts
    47

    Re: Delete workbooks with specific prefix in its name

    Hi xladept,

    The link which you have suggested, is deleting the main workbook only from which i am running the code, it is supposed to delete other open files which some specific prefix in its name.

  4. #4
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,565

    Re: Delete workbooks with specific prefix in its name

    Hi Manish84,

    Try this (just bear in mind that files will be deleted, no questions asked so back them up if need be):

    Please Login or Register  to view this content.
    Regards,

    Robert
    ____________________________________________
    Please ensure you mark your thread as Solved once it is. Click here to see how
    If this post helps, please don't forget to say thanks by clicking the star icon in the bottom left-hand corner of my post

  5. #5
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Delete workbooks with specific prefix in its name

    But that link shows the use of Kill - it's a killer

  6. #6
    Registered User
    Join Date
    12-22-2013
    Location
    Delhi, India
    MS-Off Ver
    Excel 2010
    Posts
    47

    Re: Delete workbooks with specific prefix in its name

    Yes xladept, its a killer
    Last edited by Manish84; 01-27-2014 at 02:28 PM.

  7. #7
    Registered User
    Join Date
    12-22-2013
    Location
    Delhi, India
    MS-Off Ver
    Excel 2010
    Posts
    47

    Re: Delete workbooks with specific prefix in its name

    Quote Originally Posted by Trebor76 View Post
    Hi Manish84,

    Try this (just bear in mind that files will be deleted, no questions asked so back them up if need be):

    Please Login or Register  to view this content.
    Regards,

    Robert

    Thanks a lot Robert,

    Your code is working fine, and i have also learned a new thing.

    Thanks a lot Robert.
    Last edited by Manish84; 01-27-2014 at 03:04 PM.

  8. #8
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,565

    Re: Delete workbooks with specific prefix in its name

    You're welcome

+ 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. Loop for adding specific worksheets in specific workbooks
    By pankaj8219 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-13-2013, 10:22 AM
  2. [SOLVED] Macro to copy an entire worksheet from one open workbook to another with a specific prefix
    By TBJV in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-10-2013, 12:18 PM
  3. [SOLVED] Alter code to work only on workbooks with a specific prefix?
    By james 35 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-26-2013, 09:30 AM
  4. Macro to extract data from multiple workbooks, specific sheet, specific cells
    By crissandraauree in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-29-2012, 03:54 PM
  5. How to search multiple workbooks for a specific value in a specific cell
    By jrcream in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 09-17-2008, 11:57 PM

Tags for this Thread

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