我正在做一些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 ..,
答案 0 :(得分:1)
ActiveDocument.Application.Quit
删除此行。你正在关闭Word两次。