Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default close excel; leave access open

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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default close excel; leave access open

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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
quick access tool bar show/hide custom button on open/close workbo JCIrish Excel Programming 3 September 30th 09 06:05 PM
how do I toggle between 2 open excel files and leave both open Big D in Brighton Excel Discussion (Misc queries) 1 November 6th 08 04:28 PM
How to close Access from Excel VBA Steve P[_2_] Excel Programming 2 October 12th 07 10:37 PM
Open Access, Paste data to table, and close all from Excel Macro learningaccess Excel Programming 2 April 26th 07 04:04 PM
very difficult code that will close original workbook and leave another open reesmacleod Excel Programming 4 December 3rd 03 11:21 PM


All times are GMT +1. The time now is 01:07 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"