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
Jezebel - 27 Aug 2006 03:37 GMT
Do Until pobjApp.Workbooks.Count = 0
pobjApp.Workbooks(1).Close SaveChanges:=False
Loop
> Recently i received great help closing excel files while exiting excel. I
> now
[quoted text clipped - 25 lines]
> thanks in anticipation
> colt
colt - 27 Aug 2006 04:41 GMT
Thanks Jezebel that has worked great.
> Do Until pobjApp.Workbooks.Count = 0
> pobjApp.Workbooks(1).Close SaveChanges:=False
[quoted text clipped - 29 lines]
> > thanks in anticipation
> > colt