gpt4 book ai didi

java - 自动将 Excel 2007 转换为 Excel 97-2003 工作簿

转载 作者:行者123 更新时间:2023-12-01 12:33:35 31 4
gpt4 key购买 nike

我需要将 Excel 2007 转换为 Excel 97-2003 工作簿,

我通过打开 Excel 并另存为 Excel 97-2003 工作簿来手动执行此操作
但我希望它是自动化的。可以吗

最佳答案

将要转换的文件的文件规范放入 Sheet1A 列中,如下所示:

enter image description here

.

然后运行这个小VBA宏:

Sub asdf()
Dim s As String, N As Long, i As Long
Sheets("Sheet1").Activate
N = Cells(Rows.Count, "A").End(xlUp).Row
For i = 1 To N
s = Cells(i, 1).Value
Workbooks.Open Filename:=s
s = Replace(s, ".xlsx", ".xls")
s = Replace(s, "xlsm", ".xls")
ActiveWorkbook.SaveAs Filename:=s, _
FileFormat:=xlExcel8, Password:="", _
WriteResPassword:="", _
ReadOnlyRecommended:=False, _
CreateBackup:=False
ActiveWorkbook.Close
Next i
End Sub

关于java - 自动将 Excel 2007 转换为 Excel 97-2003 工作簿,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25748487/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com