Closing and saving an object

B

brunosic2005

Hi, I used this code to get a file

Set objword = GetObject(, "Word.Application")
objword.Visible = True
objword.Documents.Open ("c:\teste\test.xls")

it is working, but, when I try to close

objword.Close SaveChanges:=True

simply don't work.
 
T

Tony Jollans

You *Close* a Word Document
You *Quit* the Word Application

So you could just do ...

objWord.Quit SaveChanges:=True

but better would be

objWord.ActiveDocument.Close SaveChanges:=True
objWord.Quit
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top