VBScript在不启用兼容模式的情况下将DOC转换为DOCX

下面的我的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调用之前/期间/之后调用,以免发生这种情况?

gjuny 回答:VBScript在不启用兼容模式的情况下将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)
'FileFormat = wdFormatDocumentDefault = 16 = Word default document file format. For Word,this is the DOCX format.
'CompatibilityMode = wdCurrent = 65535 = Compatibility mode equivalent to the latest version of Word.
doc.SaveAs2 doxpath,16,65535
doc.Close
oWord.Quit
Set oFSO = Nothing
本文链接:https://www.f2er.com/2926448.html

大家都在问