• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

change file format (extension) in folder and sub folder in single go.

How Could I change file format (extension) in folder and sub folder in single go.

is there any way to change .xlsx to xlsb.

it would be great help.


Regards,
 
Check this!!!

Code:
Option Explicit
Sub rename_to_xlsb()
Dim wb As Workbook, mydir As String, objFile As Object

mydir = "C:\ABC\New folder" 'Application.ThisWorkbook.Path

Application.ScreenUpdating = False
With CreateObject("Scripting.FileSystemObject")
    For Each objFile In .GetFolder(mydir).Files
    If Right(objFile, 5) <> ".xlsx" Then GoTo N
        Set wb = Workbooks.Open(objFile)
            wb.SaveAs Replace(objFile, ".xlsx", ".xlsb"), xlExcel12
            wb.Close False
        'Kill objFile '  If orignal needs to delete
N:  Next
End With
Application.ScreenUpdating = True

MsgBox "Done"
End Sub
 
Back
Top