简体   繁体   English

Word 2007 VB.net的SaveAs 2003 Word文档

[英]SaveAs 2003 word document from word 2007 VB.net

My system has Office2007. 我的系统有Office2007。 And i use VB.Net to automate word. 而且我使用VB.Net来自动化单词。 Everything works fine. 一切正常。 But when tried to save in Word2003 format(.doc), it is not working. 但是,当尝试以Word2003格式(.doc)保存时,它不起作用。 But the saved document is readable in Word2007. 但是保存的文档在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 . 这会将文件名保存为test.doc But it won't open in Word2003. 但是它不会在Word2003中打开。 But opens flawlessly in Word2007. 但是在Word2007中可以完美打开。

How to save the document in 2003 format ? 如何以2003格式保存文档?

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/zh-cn/library/bb238158(v=office.12).aspx ,该文件将wdFormatDocument的值设置为0。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM