[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Closing Excel from Access app!!

Posted on 2002-07-13
3
Medium Priority
?
301 Views
Last Modified: 2008-03-10
I am linking to an Excel workbook from my access application using VBA.  Below is the code I use to both link to, and close the Excel workbook.  But, a new instance of Excel still runs in the background for everytime I run the import.  Help!

Set xlApp = CreateObject("Excel.Application")
Set dOpen = xlApp.Dialogs(xlDialogActivate)
bOpen = xlApp.Dialogs(xlDialogOpen).Show

...
...
...

xlApp.Quit
Set xlApp = Nothing
 
0
Comment
Question by:krolfes
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 53

Accepted Solution

by:
Ryan Chong earned 400 total points
ID: 7152039
TRy this instead:

On Error Resume Next
Set xlApp = GetObject(,"Excel.Application")
On Error Goto ErrorHandler
If xlApp Is Nothing Then Set xlApp = CreateObject("Excel.Application")
Set dOpen = xlApp.Dialogs(xlDialogActivate)
bOpen = xlApp.Dialogs(xlDialogOpen).Show

...
...
...

xlApp.Quit
Set xlApp = Nothing

We use the GetObject function to get if an instance of Excel Application is loaded in memory or not.

cheers
0
 
LVL 54

Expert Comment

by:nico5038
ID: 7281396

No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
 - Answered by: ryancys  
Please leave any comments here within the
next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !

Nic;o)
0
 

Expert Comment

by:ComTech
ID: 7315333
As per recommendation, I hace accepted ryancys comment.

Thanks,
ComTech
CS Amdin @ EE
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question