【发布时间】:2010-11-18 01:42:37
【问题描述】:
从 Excel 2007 开始,建议您为 Workbook.SaveAs 命令提供 FileFormat 参数,因为即使您指定了 .xls 文件名但没有 FileFormat 参数,它也会使文件损坏并且无法可以在 Excel 2003 中读取,因为新保存的文件将采用 ActiveWorkbook 的格式(即 2007)。
为了以 Excel 2003 兼容格式保存,建议使用以下FileFormat 值:
-4143 如果在 Excel 2003 中和 56 在 Excel 2007 中是这样:
If Val(Application.Version) < 12 Then
' You use Excel 97-2003
FileExtStr = ".xls": FileFormatNum = -4143
Else
' you use excel 2007 or later
FileExtStr = ".xls": FileFormatNum = 56
End If
但是,无论执行客户端是 Excel 2003 还是 2007,我都尝试使用 -4143 并且运行良好。任何人都可以确认是否是这种情况?
【问题讨论】:
标签: vba excel excel-2007 file-format