主题:word 不退出
我用了下列代码:
SELECT jbk
err_fnd=.F.
ON ERROR err_fnd=.T.
PUBLIC word
word=CreateObject("word.application")
Word.Selection
IF err_fnd
MESSAGEBOX("找不到“word”程序,请先安装 Microsoft office。",16,"错误...")
QUIT
ELSE
DECLARE INTEGER FindWindow IN WIN32API STRING,STRING
ctitle="thjrbak - microsoft word" &&要点在这里
ctitlea="thjrbak.doc - microsoft word" &&要点在这里
if findwindow(0,ctitle)<>0 .or.findwindow(0,ctitlea)<>0
=messagebox("文件已打开,将关闭程序!",48,"错误信息")
word.Documents.close(.F.)
word.quit
ENDIF
COPY FILE d:\gjdk\excel\thjr.doc TO d:\gjdk\excel\thjrbak.doc
Word.Documents.Open ('d:\gjdk\excel\thjrbak') &&打开文档
*word.ActiveDocument.Content.Find.Execute ("bh",.F.,.F.,.F.,.F.,.F.,.F.,.F.,.F.,ALLTRIM(客户号),2)
word.ActiveDocument.Content.Find.Execute("jkr",.F.,.F.,.F.,.F.,.F.,.F.,.F.,.F.,ALLTRIM(客户名),2)
word.ActiveDocument.Content.Find.Execute("lxdh",.F.,.F.,.F.,.F.,.F.,.F.,.F.,.F.,ALLTRIM(电话),2)
word.visible=.t.
word.ActiveDocument.saved=.t.
endif
在执行到 word.Documents.close(.F.)
word.quit 时,word没有反映,请问这是为什么?怎样处理呢?
SELECT jbk
err_fnd=.F.
ON ERROR err_fnd=.T.
PUBLIC word
word=CreateObject("word.application")
Word.Selection
IF err_fnd
MESSAGEBOX("找不到“word”程序,请先安装 Microsoft office。",16,"错误...")
QUIT
ELSE
DECLARE INTEGER FindWindow IN WIN32API STRING,STRING
ctitle="thjrbak - microsoft word" &&要点在这里
ctitlea="thjrbak.doc - microsoft word" &&要点在这里
if findwindow(0,ctitle)<>0 .or.findwindow(0,ctitlea)<>0
=messagebox("文件已打开,将关闭程序!",48,"错误信息")
word.Documents.close(.F.)
word.quit
ENDIF
COPY FILE d:\gjdk\excel\thjr.doc TO d:\gjdk\excel\thjrbak.doc
Word.Documents.Open ('d:\gjdk\excel\thjrbak') &&打开文档
*word.ActiveDocument.Content.Find.Execute ("bh",.F.,.F.,.F.,.F.,.F.,.F.,.F.,.F.,ALLTRIM(客户号),2)
word.ActiveDocument.Content.Find.Execute("jkr",.F.,.F.,.F.,.F.,.F.,.F.,.F.,.F.,ALLTRIM(客户名),2)
word.ActiveDocument.Content.Find.Execute("lxdh",.F.,.F.,.F.,.F.,.F.,.F.,.F.,.F.,ALLTRIM(电话),2)
word.visible=.t.
word.ActiveDocument.saved=.t.
endif
在执行到 word.Documents.close(.F.)
word.quit 时,word没有反映,请问这是为什么?怎样处理呢?