Closing Excel files while exiting Word

C

colt

Recently i received great help closing excel files while exiting excel. I now
needto be able to close excel files as I exit word. I have been given the
following code :

Private Sub Document_Close()

Dim pobjApp As Object
Do
On Error Resume Next
Set pobjApp = GetObject(, "Excel.Application")

On Error GoTo 0
If pobjApp Is Nothing Then
Exit Do
End If
Do Until pobjApp.Workbooks.Count = 0

'What goes here?
'I think I've tried everything?

Loop
pobjApp.Quit
Set pobjApp = Nothing
Loop
End Sub

thanks in anticipation
colt
 
J

Jezebel

Do Until pobjApp.Workbooks.Count = 0
pobjApp.Workbooks(1).Close SaveChanges:=False
Loop
 
Top