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.
0
Utf
5/27/2010 9:41:24 PM
excel.programming 6508 articles. 2 followers. Follow

1 Replies
633 Views

Similar Articles

[PageSpeed] 37

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.
0
Utf
5/27/2010 10:25:02 PM
Reply:

Similar Artilces:

Linked Charts in Excel 2000
I have an application that creates a multiple charts using data from a separate workbook. The chart workbook is sent to users at a another location. In the tools options edit menu I have uncheck "ask to update automatic links". When users open the chart workbook, it displays the File not found dialog box with the data workbook as the file. The users can click Cancel to not update the links, but I would like the chart file to not display the file not found dialog. Excel XP has a start up prompt button that lets you control the updating of the links. Does this feature exist i...

Outlook Web Access #21
Can I check my Outlook Web Access account using Outlook 2002? My office is not using a Microsoft Exchange Server. ...

Excel
Since the worm blaster virus has hit our office, I'm having a lot of problems with the subtotal function. The file hangs up then I save it and close the file - when I go back into the file, the data has been subtotaled. Does anyone know what's going on? I actually had the IT guy uninstall and reinstall excel and that did not fix the problem. Could this be related to the fact that they just installed service pack 2 yesterday?!! >-----Original Message----- >MSBlaster didn't do anything to the Office load that I >know of... this has to be unrelated to the worm. I...

remove access w2k8 server with server manager
in w2k3 I can access remote servers using Computer Management, to view logs, share and local groups/users. In w2k8 Server Manager I can't find a way to connect to a remote server. Am I missig something or there is a different way to do so? Thanks. You are not missing anything. Server Manager added this support in 2008 R2 but 2008 can only view local roles and features. You can launch mmc and the snapins you want for the remote machine. -- Alan Morris Windows Printing Team Search the Microsoft Knowledge Base here: http://support.microsoft.com/search/?adv=1 This...

Version an Excel workbook
Does anyone know how I can save mutliple versions of an Excel workbook within one xls file, just as you can do in MSWord? I use XP; among my choices (File>Save OR Save As) is one to save the workbook as 97-2002/5.0-95 workbook. Is that what you want? -- Greeting from the Gulf Coast! http://myweb.cableone.net/twodays "Daisy Mims" <Daisy.Mims@radianmi.com> wrote in message news:0d5c01c3619c$a4b53f80$a501280a@phx.gbl... > Does anyone know how I can save mutliple versions of an > Excel workbook within one xls file, just as you can do in > MSWord? ...

Excel Question: Can I add images to a drop down list box?
Hey All, I was wondering if anyone knew a way to have a drop down box that was populated by images instead of straight text. Anyone out there have some insight they wouldn't mind sharing? Thanks, Croucho Pay some developers $100000 of dollars to come up with that excel addin. "Croucho" wrote: > Hey All, > > I was wondering if anyone knew a way to have a drop down box that was > populated by images instead of straight text. Anyone out there have some > insight they wouldn't mind sharing? > > Thanks, > Croucho only if you know VBS and can ...

Does anyone know any Excel Experts ?
ExcelExperts.com is has more work than people. We are looking for Excel / VBA experts to do targetted work on a job by job basis. More info here: http://excelexperts.com/excel-vba-jobs Nick Visit www.ExcelGoodies.Com...

Problems with MS Access reading dates as US, not British formats.
Hi Folks, I downloaded a database off the MSDN website (web address:http://msdn.microsoft.com/en-us/library/dd327646.aspx). It calculates the number of working days and takes off any holidays which are stored in a separate table. It works fine, but the only problem is that when I enter dates in the holiday table, it reads it as the US format of m/d/yy instead of UK d/m/yy. I have set the regional settings to UK time/date so my dates in the Holidays table are displayed as UK, but I have to remember to enter the dates in US order, for the system to work. (I know this wil...

ThisWorkbook.Close question
Please take a look at the code below: Public Sub DumbFoo ( ) ThisWorkbook.Close() Sheet1.Range("A1").Value = -1 ThisWorkbook.Save() End Sub Is it safe to assume that the code below the "ThisWorkbook.Close()" line will NOT be executed??? My question is basically: Does all VBA code stop executing once a .Close() function is called??? Thank you! I don't believe the code would execute at all because of the parentheses after Close. It would throw an error an tell you that something is missing, or type mismatch. But, if you did...

Is there patch or soln?:When I open a shared doc the option for ".
Does anyone know a solution for preventing the "Windows in Taskbar" Option from being unselected every time I open a shared document. I am a supervisor and I have created a common work place, where items are "checked off" as completed. These items are time sensitive, hence the need for coverage of desk tasks. The only annoyance I face is when any time I open the document the "Windows in Taskbar" is disengaged. I usually go into options and reselect the option. It would be nice if I did not have to do this every day. Please let me know if you have a solution...

Access 2000 run on XP
Will access 2000 run on XP? Dennis access 97, access 95, and even access 2.0 from the early 90's will run. In fact, you can run dos based FoxPro stuff, or even the original pc spreadsheet that came out in 1981 (that is not a misprint!!). so, yes, office 2000 will win on windows 98, 2000, xp, and also vista.... -- Albert D. Kallal (Access MVP) Edmonton, Alberta Canada pleaseNOOSpamKallal@msn.com ...

How to Enable Close(cross) button of MB_YESNO messagebox
Hi, I want to enable the close(cross) button in the right corner of YESNO message box. Can anybody tell me how to do this. Klic. "Klic" <rohit.turambekar@gmail.com> wrote in message news:1186120969.045121.287770@i13g2000prf.googlegroups.com... > I want to enable the close(cross) button in the right corner of YESNO > message box. > Can anybody tell me how to do this. Why? If there is a valid answer other than yes or no, then how about a yes/no/cancel message box in which (I would guess) the x button is equivalent to cancel. That would be more standard. Da...

closing
What's the best way to close for the day? Making a backup is a given, but what about the computer? Is it better to shut everything off every day, or is it less wear and tear on the computer to leave it on all the time? Any thoughts on this would be appreciated. Craig That's a matter of preference really. Personally I always turn off my rigs at home when I'm done with them. At the store we leave most of ours on 24/7. We've done it for years with no issues. Our register must be left on as it does automatic backups to a tape drive every night. I'd set your monitors ...

Excel 2003 - VBA
I am driving a sheet with macros and sometimes cells are manipulated using offset. This can get very convoluted and doesn't always work for me. The current issue is as follows: I would like to select a cell, then use the information in that cell and others in the same row. Once I have completed cell data manipulation, I would like to select the first 25 cells in that row and change the background color to indicate that this is new data. In VBA, how do I select a range when I do not know the row, I just work off activecell and offset. Thanks, Craig If you are working off the active...

Outlook closes and closes
Hi I have a strange bug. Windows XP Sp2 and outlook from office 20003 with all service packs applied. When I start outlook from windows out of standby postion, outlook immediately after the splash screen closes without reporting any errors in the eventlog or in any other log. If I start outlook the 10th time (or so) it stabilizes and does not close anymore and everything works again. info: My machine is fully patched and I am well known with keeping things healthy. Outlook.exe Version: 11.0.6353.0 Any ideas what to do? Thanks... try the detect and repair in the help menu. >----...

Standby in Excel
Everytime I want to get from one sheet to the next, I hit Control and Page Down at the same time. But instead of it going to the next sheet, my computer switches to Standby mode. Any idea how to disable this? Hi Lillian, That is not normal in Windows or Excel that I'm aware of. What make and model computer is it? Sounds like a BIOS setting if anything. -- John johnf 202 at hotmail dot com "Lillian" <lillian_simms@hotmail.com> wrote in message news:170be01c4183b$4fa13ac0$a501280a@phx.gbl... | Everytime I want to get from one sheet to the next, I hit | Control and ...

Outlook Web Access #9
Hi, I'm running 2 Exchange 5.5 servers, one on a W2k box, one on a NT4 box. I just installed OWA onto a third server, which is W2k, and is running IIS. I only installed OWA, nothing else. I upgraded it to SP4, same as the 2 mail servers. Question is - where do I go from here?! I can't see anywhere on the IIS server to configure. Should I have installed Exchange admin onto the server as well as OWA? Is the configuration and set up done at the email server? Thanks in advance Steve http://support.microsoft.com/default.aspx?scid=kb;en-us;234805 On Wed, 19 May 2004 00:17:04 +010...

Excel 2003 charts will not auto update to new data. Ideas?
When I input new data in a cell it over top of data that is already in within the cell range of my chart, the new number will not show within the chart. The chart simply does not update unless I close the file and then open again. As a side note I'd like to mention: 1) The data that I change is already withing the cell range of the chart. 2) The data is withing the same work book. This is not a matter of linking books. Any ideas? ...

Excel Form and message box
Hi there, I'm running Excel 2000. I am just learning so please excuse my questions if they sound simple. To put this as simply as possible I have a spreadsheet of children's names. I've created a form that is activated by a control button. What I want to do is choose a child's name from the combo box and eventually delete that child from the spreadsheet. I have an "are you sure" type msgbox but cannot get the yes/no side of it functioning correctly. I've worked on this for hours and have just given up. This is my code so far: Private Sub cboRemChild_...

Help
When creating or fowarding an e-mail message using outlook 2000, scrolling through my "recipients" list (contacts) causes the program to close unexpectedly. So, I click "new", click "to", switch to my "contacts" list, and as I scroll through the names, the program just closes. Is there a possibility that one of my contact records is corrupt? I have opened all of my contacts and saved them without an error. This problem developed shortly after the install of Office 2000's calender update, and basic security update. I have since fully u...

Excel hang-up/crash problem
I have two realively large workbooks with macros. Data is to b exchanged between them. But when I have both two open, Excel jus halts/crashes without any error message. Separately both works jus fine (also at the same time running in separate Excel applications). Any ideas on how to fix this? Could settings for mermory be the thing? How can I change the me settings? (i run Excel 2000 on XP Pro.) Thanx in advance! Georg Rokn -- Message posted from http://www.ExcelForum.com Hi gerok! Find and Select C:\Documents and Settings\<user>\local settings\temp Select all files and delete...

slide show of charts from excel
I have an excel file which is a shared workbook and is updated many times a day by several users which has several charts included at a remote location on our wan, i would like to display these charts in a slide show format on a large screen at my local office and have them permanently run and update as linked cells are changed by users. any help much appreciated. If you have the full Office Suite which includes PowerPoint you can link Excel Charts to a PowerPoint presentation. Otherwise...........I have no ideas. Gord Dibben MS Excel MVP On Wed, 21 Mar 2007 18:58:23 -0000, "...

Use of CLIPBOARD in EXCEL
Why do items put on to the CLIPBOARD in EXCEL disappear the moment ypu type something in a cell? Is there any way of disabling this very annoying feature? If you're using Excel 2002, or later version, you can use the Office Clipboard, which stores more items. To see it, choose Edit>Office Clipboard. alandwebb wrote: > Why do items put on to the CLIPBOARD in EXCEL disappear the moment ypu type > something in a cell? Is there any way of disabling this very annoying feature? -- Debra Dalgleish Excel FAQ, Tips & Book List http://www.contextures.com/tiptech.html ...

Open file already open by other user
I have asked some of it already and I thought I had the answer but not really. I have a macro where I open a file that can be access by others.... If the file is already open by other user it asked me if I want to be notified or cancel but I do not want it to do it... I did try on error resume next open file... but it actually tell me file is open by others so it does not resume next... I need to open as read only without being told when it is already open by others or open as write if not being used by others... I did try the wb.ReadOnly but it will be useful only afte...

Workflow Rule -> Closing Activity
I set up a Manual Workflow Rule for Contacts to close out Holiday Season cards sent. The rule uses a condition to check for Contacts with cards sent and then Creates an Activity to add to each of the appropriate Contacts for future reference. What else do I need to do to close out all of activites rather than 1 at a time? Here is the workflow rule if that helps: if Contact.holidaycardlist = 1 then Letter: Send Holiday Card endif -- Dan W Systems Engineer Denver, CO ...