+ Reply to Thread
Results 1 to 10 of 10

Kill ONLY .xls (2003 excel) files

  1. #1
    Registered User
    Join Date
    06-18-2013
    Location
    Calgary, Canada
    MS-Off Ver
    Excel 2010
    Posts
    17

    Kill ONLY .xls (2003 excel) files

    Hi

    I have a macro that converts old .xls files to .xlsx files.
    After that is run I want to delete all the .xls files

    I have used the following code
    Please Login or Register  to view this content.
    However that is deleting the newly created .xlsx files as well

    Any suggestions?

    Thanks

  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: Kill ONLY .xls (2003 excel) files

    Hello Shift-4,

    Are you sure it reads
    Please Login or Register  to view this content.
    And not this. Notice the extra asterisk at the end of xls.
    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!)

  3. #3
    Registered User
    Join Date
    06-18-2013
    Location
    Calgary, Canada
    MS-Off Ver
    Excel 2010
    Posts
    17

    Re: Kill ONLY .xls (2003 excel) files

    Yup. 100% sure. Copied my sample directly from my code.

    I thought the same thing and double checked myself

  4. #4
    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: Kill ONLY .xls (2003 excel) files

    Hello Shift-4,

    Can you post the code for the Sub or Function you are using?

  5. #5
    Registered User
    Join Date
    06-18-2013
    Location
    Calgary, Canada
    MS-Off Ver
    Excel 2010
    Posts
    17

    Re: Kill ONLY .xls (2003 excel) files

    Here is the full code.
    Replacing it to .xlsx works fine.
    The 'kill' ends up killing everything however.

    I temporarily have disabled the kill portion with '
    (just in case you though that was my issue)

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    06-18-2013
    Location
    Calgary, Canada
    MS-Off Ver
    Excel 2010
    Posts
    17

    Re: Kill ONLY .xls (2003 excel) files

    I also can't get code to work to ignore 'update links'
    If anyone could help with that it would be appreciated as well

  7. #7
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Kill ONLY .xls (2003 excel) files

    I don't have the courage to use a wildcard in a Kill statement. I would move the xls files to a temp folder in the same directory and delete them later -- much later.
    Entia non sunt multiplicanda sine necessitate

  8. #8
    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: Kill ONLY .xls (2003 excel) files

    Hello Shift-4,

    You said...
    The 'kill' ends up killing everything however.
    Does this mean it is eliminating other xls files you did not want deleted?

    The nature of the wildcard is to match any file with the pattern. In this case ALL files ending in .xls will be deleted. So not just the workbooks but also any other non workbook files too.

  9. #9
    Registered User
    Join Date
    06-18-2013
    Location
    Calgary, Canada
    MS-Off Ver
    Excel 2010
    Posts
    17

    Re: Kill ONLY .xls (2003 excel) files

    Quote Originally Posted by Leith Ross View Post
    Hello Shift-4,

    You said...


    Does this mean it is eliminating other xls files you did not want deleted?

    The nature of the wildcard is to match any file with the pattern. In this case ALL files ending in .xls will be deleted. So not just the workbooks but also any other non workbook files too.
    It also deleted .xlsx files
    I thought with using "*.xls" it should only kill those files that only end in .xls but it deleted everything.

  10. #10
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Kill ONLY .xls (2003 excel) files

    In my brief testing, it deletes any file containing .xls not followed by another dot -- bob.xls, bob.xlsm, bob.xlsabc, ..., but not bob.xls.txt.

    As I said, I don't have the courage to use a wildcard in a kill statement. They don't go to the recycle bin.

+ 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. Unzip-copy/paste specific files-kill .zip
    By hotelmrrsn in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-20-2014, 03:03 PM
  2. [SOLVED] Files starting with = kill my indexing script...any workaround?
    By Winterreise in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 07-12-2012, 09:40 AM
  3. Kill all non excel files in folder
    By uncleslinky in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-05-2012, 11:17 AM
  4. xml files in excel 2003 sp3
    By pjcoxy in forum Outlook Formatting & Functions
    Replies: 2
    Last Post: 03-16-2009, 05:29 PM
  5. Excel 2003 .XLS files
    By El Maestro in forum Excel General
    Replies: 0
    Last Post: 05-03-2005, 06:06 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