Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Quit Word Using VB 1

Status
Not open for further replies.

tuan

Programmer
Jul 17, 2001
2
US
Hi,

What I am trying to do is to write a VB program to print out a number of word documents. So far, I can open a word document, print it out, close the file, but I could not quit the word application itself.

This is my code.
----------------
Dim WordObj As Object
Set WordObj = CreateObject("Word.Basic")
WordObj.FileOpen Name:="""a:\tuan.doc"""
WordObj.FilePrintDefault
WordObj.FileClose 2
Set WordObj = Nothing

After the program is done running, I press Alt+Ctrl+Del. There is a WinWord still running. I do not know what to do.Is anybody out there has already had this problem before.Please, show me. Your help is very much appreciated. Thanks in advance.

Tuan.

 
Insert WordObj.Quit before setting the object to nothing.

Dim WordObj As Object
Set WordObj = CreateObject("Word.Basic")
With WordObj
.FileOpen Name:="""a:\tuan.doc"""
.FilePrintDefault
.FileClose 2
.Quit
End With
Set WordObj = Nothing


_________________________________
In theory, there is no difference between theory and practice. In practice, there is. [attributed to Yogi Berra]
 
It works. Thank you very much for your help. I really appreciate it.

Tuan.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top