Microsoft Excel是Microsoft为使用Windows和Apple Macintosh操作系统的电脑编写的一款电子表格软件。直观的界面、出色的计算功能和图表工具,再加上成功的市场营销,使Excel成为最流行的个人计算机数据处理软件。 Option Explicit Sub xlsTOxlsx() Dim strFilePath As String, strFileName As String, strFileType As String Dim aIndex As Long, arrFileName() As String, strNewName As String '设置文件扩展名标识文件类型 strFileType = ".xls" On Error Resume Next '设置文件夹路径 strFilePath = CreateObject("shell.application").BrowseForFolder(0, "请选择文件夹", 0).self.Path If Err <> 0 Or InStr(1, strFilePath, "::") > 0 Then Err = 0 Exit Sub End If '开始搜索文件 strFileName = Dir(strFilePath & "*.*") Do While strFileName <> "" If LCase(Right(strFileName, Len(strFileType))) = LCase(strFileType) Then ReDim Preserve arrFileName(aIndex) arrFileName(aIndex) = strFileName aIndex = aIndex + 1 'Debug.Print strFileName End If strFileName = Dir DoEvents Loop If aIndex = 0 Then Exit Sub Application.ScreenUpdating = False Application.DisplayAlerts = False For aIndex = LBound(arrFileName) To UBound(arrFileName) strNewName = Mid(arrFileName(aIndex), 1, Len(arrFileName(aIndex)) - Len(strFileType)) & ".xlsx" Workbooks.Open strFilePath & arrFileName(aIndex) ActiveWorkbook.SaveAs Filename:=strFilePath & strNewName, FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False Workbooks(strNewName).Close False '关闭工作簿 Kill strFilePath & arrFileName(aIndex) DoEvents Next Application.DisplayAlerts = True Application.ScreenUpdating = True MsgBox "操作完成,共为您转换了 " & UBound(arrFileName) + 1 & " 个文件。", vbOKOnly, "完成" End Sub
Excel整体界面趋于平面化,显得清新简洁。流畅的动画和平滑的过渡,带来不同以往的使用体验。 |