通过 vb6 重新打开 MS 文档时出错
我正在做一些 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..,
I'm doing SOME VB6 - MS WORD application.., here's my code
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
after 1st opening on the file PN.doc and save it as [name]-PN.doc. it works fine. if I reopen it and re save it. an error came up and says
The remote sever machine does not exist or is unavailable
when i try to open the PN.doc in a word application, an error will pup-out and says
the document has caused a serious error the last time it was opened. Would you like to continue opening it?
im using visual basic6 and ms office 2010
tnx..,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
删除此行。您正在关闭 Word 两次。
Remove this line. You are closing Word twice.