+ Reply to Thread
Results 1 to 3 of 3

Save all .xlsx files in a directory to .xls

  1. #1
    Registered User
    Join Date
    02-23-2012
    Location
    Boston
    MS-Off Ver
    Excel 2007
    Posts
    2

    Save all .xlsx files in a directory to .xls

    I'm attempting to open each .xlsx file in a specified directory, then save each file as .xls in a sub directory without dialog boxes appearing and overwriting any existing files in the subdirectory with the same name. The number of files in the directory will vary. Is there a simple VBA script for Excel 2007 that will do this?
    Last edited by paul00; 02-24-2012 at 08:10 PM.

  2. #2
    Valued Forum Contributor smuzoen's Avatar
    Join Date
    10-28-2011
    Location
    Brisbane, Australia
    MS-Off Ver
    Excel 2003/2007/2010
    Posts
    610

    Re: Save all .xlsx files in a directory to .xls

    There are some commercial applications out there that you can use however here is my version. This code will allow you to browse to the directory containing the files you want to convert from xlsx to xls files (Word 97-2003). It will create the xls files in a subdirectory of the directory you selected called ConvertedFiles. If the sub directory does not exist then it creates it. If when creating the xls files in the ConvertedFiles subdirectory the situation arises that the file exists already I rename the file by appending the current time to the file name. It will iterate through all files in the directory you selected and only convert the xlsx files. There is a button on Sheet 1 of the workbook that will run the code. You could modify the code so the subdirectory could be called something else and you could change the string that is appended to a file if it already exists - really you need something random that is why I selected hours minutes seconds (hhmmss). I have suppressed all alerts so you should not need to interact with the code when it is running. How long the code takes to run depends on the number of files to convert however it should not be a long process.
    See attached workbook.
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by smuzoen; 02-24-2012 at 08:56 AM.
    Hope this helps.
    Anthony
    Pack my box with five dozen liquor jugs
    PS: Remember to mark your questions as Solved once you are satisfied. Please rate the answer(s) by selecting the Star in the lower left next to the Triangle. It is appreciated?

  3. #3
    Registered User
    Join Date
    02-23-2012
    Location
    Boston
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Save all .xlsx files in a directory to .xls

    absolutely perfect! thanks for the help!

+ 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