+ Reply to Thread
Results 1 to 2 of 2

vba code to loop through desktop, folder & subfolders to kill specific file extensions .

  1. #1
    Forum Contributor
    Join Date
    02-11-2014
    Location
    mauritius
    MS-Off Ver
    MS365
    Posts
    1,086

    vba code to loop through desktop, folder & subfolders to kill specific file extensions .

    How to loop through desktop , folder and subfolder to kill all *.xlsx files.

    The latter is C:\Users\User1\Desktop there are many folders with one level subfolders.

    That is all extensions with *.xlsx on desktop, folder and subfolders of desktop of one level

    Can anyone assist

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: vba code to loop through desktop, folder & subfolders to kill specific file extensio

    Hello Jean1972,

    This macro will allow you to delete any file by full or partial name or file extension.

    Add a new VBA module to your workbook and copy the macro code into it. There is an example macro that deletes all xlsx files on the Desktop and in all folders and subfolders. You can control the subfolder search depth to whichever level you want. See the comments in the macro.

    Delete Files Macro
    Please Login or Register  to view this content.
    Example Macro
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

+ 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] macro to delete prefix and file extension through desktop and its subfolders
    By JEAN1972 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-28-2018, 06:08 PM
  2. [SOLVED] macro to delete all CSV files on my desktop desktop folders and and its subfolders
    By JEAN1972 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 07-19-2017, 03:42 PM
  3. Get Value Function Loop through all files in folder and its subfolders
    By Cheeseburger in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 03-27-2016, 06:19 PM
  4. [SOLVED] Extend Existing Code to Loop Through All Subfolders in a Folder
    By XOR LX in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-08-2014, 08:47 AM
  5. [SOLVED] Macro to save workbook to specific folder with a specific name, then kill/disable itself.
    By jonvanwyk in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-18-2012, 03:50 PM
  6. Macro to Loop within all subfolders in a folder in three levels
    By sarakhalatbari in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-22-2011, 06:20 AM
  7. Loop Thru Wkbks in folder and subfolders
    By Diddy in forum Excel General
    Replies: 2
    Last Post: 10-19-2011, 02:25 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