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
 
Top