本文作者:office教程网

excel VBA将一个目录下的所有xls文件批量转换为xlsx文件

office教程网 2023-06-16 01:35:00 329
后台-插件-广告管理-内容头部广告位
后台-系统设置-扩展变量-手机广告位-内容正文顶部
摘要: Option Explicit
Sub xlsTOxlsx() Dim strFilePath As String, strFileName As String, strFileType As String Dim aIndex As Long, arrFileName() As String, strNewName As String
'设置文件扩展名标识文件类型 strFile...

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"

如何利用excel快速提取身份证号码中出生日期

用Excel快速提取身份证号码中出生日期只需在旁边输入一个模板,然后按快捷键Ctrl E就能快速的提取出生年月。excel提取身份证号码中出生日期

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 VBA将一个目录下的所有xls文件批量转换为xlsx文件的下载地址:
  • 本地下载

  • 如何让excel自动记录录入时间

    我们在做表格录入数据的时候,有时候会根据需要录入当前录入数据的时间,以便于做记录查询。那这个自动记录录入时间有啥好办法吗?像系统一样自动录入可以吗?Excel真的能够自动记录录

    后台-插件-广告管理-内容底部广告位
    后台-系统设置-扩展变量-手机广告位-内容正文底部
    未经允许不得转载:

    作者:office教程网,原文地址:excel VBA将一个目录下的所有xls文件批量转换为xlsx文件发布于2023-06-16 01:35:00
    转载或复制请以超链接形式并注明出处 演示站

    分享到:

    觉得文章有用就打赏一下文章作者

    支付宝扫一扫打赏

    微信扫一扫打赏