【发布时间】:2019-12-13 14:19:30
【问题描述】:
下面我的 VBScript 将 Word DOC 转换为 DOCX:
Set oFSO = CreateObject("Scripting.FileSystemObject")
fullpath = oFSO.GetAbsolutePathName(Wscript.Arguments.Item(0))
justpath = Left(fullpath, InStrRev(fullpath, "\"))
basename = oFSO.GetBaseName(fullpath)
doxpath = justpath & basename & ".docx"
Set oWord = CreateObject("Word.Application")
Set doc = oWord.Documents.Open(fullpath)
doc.SaveAs2 doxpath, 16
doc.Close
oWord.Quit
Set oFSO = Nothing
但是,当我打开输出 DOCX 时,顶部显示“[兼容模式]”。在 SaveAs2 调用之前/期间/之后,我是否可以设置一些属性或调用方法,以免发生这种情况?
【问题讨论】:
-
你看过
SaveAs2()的文档吗? docs.microsoft.com/en-us/office/vba/api/word.saveas2 -
是的。但这是一个 VBA 页面,兼容性选项位于一长串参数的末尾,无法在 VBS 中指定命名参数,我不想指定所有参数。
-
您可以跳过不想提供的可选参数,只需写下相应数量的空逗号:
.SomeMethod RequiredArg, , , , , , OptionalArg。 -
Niiice。不知道。谢谢!