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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Close Word App from VB

Status
Not open for further replies.

bsurfn99

Technical User
Mar 23, 2005
34
US
I know this has been asked many times, but I am missing something. I can close my file, but would like to close the window application it created as well. I seem to be stuck, can anyone help me out?


Here is what I've come up with,


' close form
Unload Send_to_information
'close document/workbook
ActiveDocument.ActiveWindow.Close savechanges:=False
'
'close word App
Dim wordapp As Object
Set wordapp = CreateObject("Word.Application")
wordapp.Quit (wdDoNotSaveChanges)
Set wordapp = Nothing
End Sub



Thanks,
BsurfN99
 
? What do you want to do ?

This: wordapp.Quit (wdDoNotSaveChanges)
Set wordapp = Nothing

Do not work?
 
Well I didn't think it was working earilier, becuase I only had one window of Word open. It would leave Word open. Once I had multiple doc files open I notice it did close the word app for the file.

Is there a way to close out the application completely when only one window is open?

BsurfN99
 
If you load for example 3 files, 3 word applications will be on the task bar?
 
correct,

if I only have 1 word app open, it will not close.
 
Hi

dim wa as Object

set wa = CreateObject("Word.Application")

wa.Documents.Open filename ...
...
do some processing on file
...
' Save & Close active document
wa.ActiveDocument.Close True

wa.Quit

set wa = nothing

Should do the trick , I ma coding si=oething similat just now and that is my code and it works...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top