Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.access.modulesdaovba,microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default Closing Excel from Access

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?
  #2   Report Post  
Posted to microsoft.public.access.modulesdaovba,microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default Closing Excel from Access

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?

  #3   Report Post  
Posted to microsoft.public.access.modulesdaovba,microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Closing Excel from Access

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
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
Closing Excel from Access Tom Ogilvy Excel Programming 0 March 28th 07 12:20 AM
Access Violation when closing Excel. Rich[_16_] Excel Programming 1 December 3rd 03 08:33 AM
Closing Access Mark[_22_] Excel Programming 3 December 1st 03 11:15 PM
Closing Excel from Access Tom Ogilvy Excel Programming 0 August 27th 03 05:28 PM
Closing Excel error message from Access 2K Dave[_23_] Excel Programming 1 August 8th 03 10:54 AM


All times are GMT +1. The time now is 12:41 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"