Postingan

Menampilkan postingan dari Maret, 2017

VBA Macro convert XLS to XLSX

Sub ChangeFileFormat()     Dim strCurrentFileExt   As String     Dim strNewFileExt       As String     Dim objFSO              As Object     Dim objFolder           As Object     Dim objFile             As Object     Dim xlFile              As Workbook     Dim strNewName          As String     Dim strFolderPath       As String     strCurrentFileExt = ".xls"     strNewFileExt = ".xlsx"     strFolderPath = "e:\data\garut\xlsxsemua\aswandi"     If Right(strFolderPath, 1) <> "\" Then         strFolderPath = strFolderPath & "\"     End If     Set objFSO = CreateObject("Scripting.FileSystemObject")     Set objFolder = objFSO.getfolder(strFolderPath)     For Each objFile In objFolder.Files         strNewName = objFile.Name         If Right(strNewName, Len(strCurrentFileExt)) = strCurrentFileExt Then             Set xlFile = Workbooks.Open(objFile.Path, , True)             strNewName = Replace(strNe