Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / August 2006

Tip: Looking for answers? Try searching our database.

Closing Excel files while exiting Word

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
colt - 27 Aug 2006 02:47 GMT
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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.