我正在做一些VB6 - MS WORD应用程序。,这是我的代码
dim WordObj As Word.Application
Dim objWord As Word.Document
Set WordObj = new Word.Application
Set objWord = WordObj.Documents.Open(FileName:=App.Path & "PN.doc")
With objWord.Bookmarks
.Item("NAME").Range.Text = name.Text
.Item("ADDRESS").Range.Text = add.Text
.Item("ID").Range.Text = id.Text
.Item("PHONE").Range.Text = phone.Text
.Item("FAX").Range.Text = fax.Text
End With
ActiveDocument.SaveAs (App.Path & "" & name.text & "-PN.Doc")
ActiveDocument.Application.Quit
WordObj.Quit False
Set WordObj = Nothing
Set objWord = Nothing
第一次打开后的文件PN.doc,并保存为[name]-PN.doc。它工作得很好。如果我重新打开并保存它。出现错误,提示
The remote sever machine does not exist or is unavailable
当我尝试在word应用程序中打开PN.doc时,会弹出一个错误并说
the document has caused a serious error the last time it was opened. Would you like to continue opening it?
我用的是visual basic6和ms office 2010
tnx . .
ActiveDocument.Application.Quit
删除这一行。