PC Review


Reply
Thread Tools Rate Thread

close excel; leave access open

 
 
Domenick
Guest
Posts: n/a
 
      27th May 2010
Here is the end part of my code (lots of other stuff done first) where I want
to open a database in Access (so that the user can take further action) and
then close out excel:

Set mdapp = CreateObject("access.application")
With mdapp
..Visible = True
..OpenCurrentDatabase ("S:\Financial Analysis\Labor Report.mdb")
End With
Windows("labor report.xls").Activate
ActiveWorkbook.Save
ActiveWorkbook.Close
Excel.Application.Quit

However, this closes out the MS Application as well as the Excel
Application. Note: This only started happening when I switched to Excel 2007
from 2003 (in 2003, excel would close but access would stay open). Anyone
know what could have changed? How should I re-write to get the desired result?

Thanks.
 
Reply With Quote
 
 
 
 
Barb Reinhardt
Guest
Posts: n/a
 
      27th May 2010
I'm not sure I'd put it here, but here's some code to try

Dim xlApp as excel.application
ActiveWorkbook.Save
Set xlApp = Application
ActiveWorkbook.Close

'i suspect you're running this code in excel.
'When you do this, execution of your excel code ends
xlApp.Quit

If you run the code out of another application, it should quit excel and
keep the other application open.
--
HTH,

Barb Reinhardt



"Domenick" wrote:

> Here is the end part of my code (lots of other stuff done first) where I want
> to open a database in Access (so that the user can take further action) and
> then close out excel:
>
> Set mdapp = CreateObject("access.application")
> With mdapp
> .Visible = True
> .OpenCurrentDatabase ("S:\Financial Analysis\Labor Report.mdb")
> End With
> Windows("labor report.xls").Activate
> ActiveWorkbook.Save
> ActiveWorkbook.Close
> Excel.Application.Quit
>
> However, this closes out the MS Application as well as the Excel
> Application. Note: This only started happening when I switched to Excel 2007
> from 2003 (in 2003, excel would close but access would stay open). Anyone
> know what could have changed? How should I re-write to get the desired result?
>
> Thanks.

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Close subform but leave main form open JoeP Microsoft Access Forms 0 17th Aug 2008 02:43 PM
How do I close a document but leave application open? =?Utf-8?B?cmFwZXJyeQ==?= Microsoft Word Document Management 4 2nd Nov 2006 03:17 PM
Singleton Pattern for Database Access --- Leave Open or Close Connection mescano Microsoft VB .NET 4 13th Apr 2005 03:12 PM
Re: How do I close some Excel files and leave others open without sav. JulieD Microsoft Excel Misc 0 14th Sep 2004 04:11 PM
very difficult code that will close original workbook and leave another open reesmacleod Microsoft Excel Programming 5 4th Dec 2003 02:32 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:30 PM.