2011-07-11 48 views
0

重新打开MS文档,我做了一些VB6 - MS Word应用程序......,这里是我的代码错误上通过VB6

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 1日开幕后,并保存为[名] -PN.doc。它工作正常。如果我重新打开并保存它。错误过来了,说

The remote sever machine does not exist or is unavailable 

当我尝试在Word应用程序打开PN.doc,错误将PUP-,并在使用可视basic6和MS Office 2010说

the document has caused a serious error the last time it was opened. Would you like to continue opening it? 

IM

TNX ..,

回答

1

ActiveDocument.Application.Quit

删除此行。你正在关闭Word两次。

+0

我在哪里第一次结束?..,我用这个过程在打印PN(本票)?..,tnx为rply – rekcah101

+0

我会尝试修改我的代码..,做你的建议.., – rekcah101