Edward S Zuris
edzedz at comcast.net
Mon Jun 16 12:39:21 CDT 2008
Looks like you are doing the early binding thus you shouldn't have trouble with orphan instances of Excel. Here is an example of how I shut down an instance of Excel. = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = ' ***************************************************** ' ***************************************************** ' Size First Worksheet Window ' ExcelCopy.sheets(1).Select ExcelCopy.sheets(1).Range("A1:A1").Select ExcelCopy.Application.ActiveWindow.Width = 680 ExcelCopy.Application.ActiveWindow.Height = 440 ' ***************************************************** ' Write the new Excel data to Disk. ' ExcelCopy.Application.DisplayAlerts = False ExcelCopy.SaveAs sXLSfilename ExcelSheet.Application.Quit ExcelCopy.Application.DisplayAlerts = True Set ExcelSheet = Nothing Set ExcelCopy = Nothing = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Hewson, Jim Sent: Monday, June 16, 2008 8:26 AM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Hide datasheet view of table when appending Thanks, Lambert. Sorry, it's taken so long to respond... I had the audacity to take a couple of days off. I still can't get Excel to shutdown, though. It's still open in the task manager. Jim jhewson at nciinc.com -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Heenan, Lambert Sent: Friday, June 13, 2008 4:13 PM To: 'Access Developers discussion and problem solving' Subject: Re: [AccessD] Hide datasheet view of table when appending Quitting Excel. This is how I do it... Sub Excel_CloseWorkBook(xlApp As Excel.Application, Optional bSaveChanges As Boolean = False) Dim wb As Excel.Workbook On Error Resume Next If xlApp.Name > "" Then ' reference a property to see if we get an error End If If Err.Number <> 0 Then Exit Sub ' already closed On Error GoTo 0 For Each wb In xlApp.Workbooks 'Close all open workbooks wb.Close bSaveChanges Next wb xlApp.UserControl = False Set xlApp = Nothing End Sub The crucial statement is "xlApp.UserControl = False ". Leave it out and Excel will not shut down. In use it's a case of setting all your references to worksheets to nothing and then call Excel_CloseWorkBook objExlApp, [True|False] HTH - works for me. :-) Lambert -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Hewson, Jim Sent: Friday, June 13, 2008 3:54 PM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Hide datasheet view of table when appending I've used a Recordset before, I didn't think about using it. I have the TransferSpreadsheet working as Lambert suggested and everything is working. My only problem now is that Excel won't shut down even though I tell it to quit and set the reference to nothing. Thanks everyone for your help. Jim jhewson at nciinc.com -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Drew Wutka Sent: Friday, June 13, 2008 2:48 PM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Hide datasheet view of table when appending The difference is control, without opening Excel. Have you ever used a recordset in code? With ADO, you can open an excel spreadsheet as a recordset. Don't even have to have Excel installed on the machine. Drew ############################################################################ #### This email transmission contains information from NCI Information Systems, Inc. that may be considered privileged or confidential and is intended solely for the named recipient. If you have received this message in error, please contact the sender immediately and be aware that the use, copying or dissemination of this information is prohibited. ############################################################################ #### -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com ############################################################################ #### This email transmission contains information from NCI Information Systems, Inc. that may be considered privileged or confidential and is intended solely for the named recipient. If you have received this message in error, please contact the sender immediately and be aware that the use, copying or dissemination of this information is prohibited. ############################################################################ #### -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com