PC Review


Reply
Thread Tools Rate Thread

Closing Excel from Access

 
 
=?Utf-8?B?SlJfMDYwNjIwMDU=?=
Guest
Posts: n/a
 
      28th Mar 2007
Access creates a report which is exported to Excel using the
TransferSpreadsheet function. My code then opens the file in Excel workbook,
makes some format changes and then saves and closes the file.

The workbook I created closes, but Excel, with no open workbook, remains
open. I tried to close it with the code Excel.Application.Quite. But this
does not close the application.

How do I close the whole Excel application?
 
Reply With Quote
 
 
 
 
=?Utf-8?B?SlJfMDYwNjIwMDU=?=
Guest
Posts: n/a
 
      28th Mar 2007
I think you are exactly right. The problem is I can't figure out how to
create a quailfied copy. What I'm doing is creating a spreadsheet with the
TransferSpreadsheet function and then bringing up the workbook that the
TransferSpreadsheet function just created, making some changes and then
closing the workbook. What I want to do after I finish the changes, is close
the workbook and if Excel is not running, close down Excel. Problem is I can
only close the workbook, not the program even if Excel was not previously
running. By the way I have code to tell me whether Excel is running.

As I understand the process, when I create a new workbook, if Excel was not
already running, then it is automatically started (which is an unqualified
reference). So how do I make a qualified reference?

"Tom Ogilvy" wrote:

> You are probably creating an unqualified reference to Excel. Since it is
> unqualified, it can't be released and excel stays in memory until you hit the
> reset button in Access or you might even have to close Access.
>
> always fully qualify all your references
>
> rather than
> selection.Value = 3
> xlapp.Selection.Value = 3
>
> where xlApp represents the reference you created when you started Excel
> through automation.
>
> --
> Regards,
> Tom Ogilvy
>
> "JR_06062005" wrote:
>
> > Access creates a report which is exported to Excel using the
> > TransferSpreadsheet function. My code then opens the file in Excel workbook,
> > makes some format changes and then saves and closes the file.
> >
> > The workbook I created closes, but Excel, with no open workbook, remains
> > open. I tried to close it with the code Excel.Application.Quite. But this
> > does not close the application.
> >
> > How do I close the whole Excel application?

 
Reply With Quote
 
=?Utf-8?B?VG9tIE9naWx2eQ==?=
Guest
Posts: n/a
 
      28th Mar 2007
I assumed you opened the workbook using automation, If the
Transferspreadsheet function opens excel as a byproduct of creating the
sheet, then I couldn't say. If you are using automation, then you should e
creating a reference to excel

oxlApp = GetObject(,"Excel.application")
set oxlBk = oxlApp.workbooks.Open("Mynewbook.xls")

and so forth.

--
Regards,
Tom Ogilvy



"JR_06062005" wrote:

> I think you are exactly right. The problem is I can't figure out how to
> create a quailfied copy. What I'm doing is creating a spreadsheet with the
> TransferSpreadsheet function and then bringing up the workbook that the
> TransferSpreadsheet function just created, making some changes and then
> closing the workbook. What I want to do after I finish the changes, is close
> the workbook and if Excel is not running, close down Excel. Problem is I can
> only close the workbook, not the program even if Excel was not previously
> running. By the way I have code to tell me whether Excel is running.
>
> As I understand the process, when I create a new workbook, if Excel was not
> already running, then it is automatically started (which is an unqualified
> reference). So how do I make a qualified reference?
>
> "Tom Ogilvy" wrote:
>
> > You are probably creating an unqualified reference to Excel. Since it is
> > unqualified, it can't be released and excel stays in memory until you hit the
> > reset button in Access or you might even have to close Access.
> >
> > always fully qualify all your references
> >
> > rather than
> > selection.Value = 3
> > xlapp.Selection.Value = 3
> >
> > where xlApp represents the reference you created when you started Excel
> > through automation.
> >
> > --
> > Regards,
> > Tom Ogilvy
> >
> > "JR_06062005" wrote:
> >
> > > Access creates a report which is exported to Excel using the
> > > TransferSpreadsheet function. My code then opens the file in Excel workbook,
> > > makes some format changes and then saves and closes the file.
> > >
> > > The workbook I created closes, but Excel, with no open workbook, remains
> > > open. I tried to close it with the code Excel.Application.Quite. But this
> > > does not close the application.
> > >
> > > How do I close the whole Excel application?

 
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
Closing Excel from Access =?Utf-8?B?SlJfMDYwNjIwMDU=?= Microsoft Access VBA Modules 2 28th Mar 2007 08:22 PM
RE: Closing Excel from Access =?Utf-8?B?VG9tIE9naWx2eQ==?= Microsoft Access VBA Modules 0 28th Mar 2007 12:20 AM
Closing Excel files from Access and/or quitting Excel from Access Beverly Microsoft Access VBA Modules 1 11th Oct 2003 06:49 PM
Closing Excel from Access G Ramon Microsoft Access VBA Modules 1 11th Oct 2003 04:57 PM
Re: Closing Excel from Access Tom Ogilvy Microsoft Excel Programming 0 27th Aug 2003 05:28 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:43 AM.