vba 另存为 2003 Word 文档来自 Word 2007 VB.net
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8271838/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
SaveAs 2003 word document from word 2007 VB.net
提问by Vpp Man
My system has Office2007. And i use VB.Net to automate word. Everything works fine. But when tried to save in Word2003 format(.doc), it is not working. But the saved document is readable in Word2007.
我的系统有Office2007。我使用 VB.Net 来自动化 word。一切正常。但是当尝试以 Word2003 格式(.doc)保存时,它不起作用。但保存的文档在 Word2007 中是可读的。
Dim WordApp As Microsoft.Office.Interop.Word.Application = New Microsoft.Office.Interop.Word.Application()
Dim MyDoc As Microsoft.Office.Interop.Word.Document
'.....
MyDoc.SaveAs("c:\test.doc")
This saves the document with the filename as test.doc
. But it won't open in Word2003. But opens flawlessly in Word2007.
这会将文件名保存为test.doc
. 但它不会在 Word2003 中打开。但在Word2007中打开完美无缺。
How to save the document in 2003 format ?
如何将文档保存为 2003 格式?
回答by Fionnuala
From macro recorded in 2010:
来自 2010 年录制的宏:
ActiveDocument.SaveAs2 FileName:="abc.doc", FileFormat:=wdFormatDocument
See also http://msdn.microsoft.com/en-us/library/bb238158(v=office.12).aspx, which gives the value for wdFormatDocument as 0.
另请参阅http://msdn.microsoft.com/en-us/library/bb238158(v=office.12).aspx,其中 wdFormatDocument 的值为 0。