MartyConnelly
martyconnelly at shaw.ca
Thu Dec 8 13:56:21 CST 2005
It maybe you are opening another instance of excel unknowingly You do have to be careful in referencing your objects. If you instanciate an Excel object and Access is not sure what higher level ojbect it belongs to, it can create another instance of Excel you don't know about and it will stay resident and be seen in the processes tab of task manager. for example inside a With objExcelDoc.Sheets(1) you do .Range(Cells(i, 1), Cells(i, 5)). instead of .Range(.Cells(i, 1), .Cells(i, 5)). Boom you have another copy of excel started Paul Hartland (ISHARP) wrote: >That's exactly the old code I had in place still getting the same >error....but I will try changing it back and running it again with Jim Hales >code in between and see what I get.... > >-----Original Message----- >From: accessd-bounces at databaseadvisors.com >[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Gustav Brock >Sent: 08 December 2005 10:19 >To: accessd at databaseadvisors.com >Subject: Re: [AccessD] Access Function To Create Spreadsheet Fails On 2nd >Run > >Hi Paul > >No, you may not be closing the workbook properly. Try this: > >objWB.Close >Set objWB = Nothing > >/gustav > > > >>>>paul.hartland at isharp.co.uk 08-12-2005 09:57:32 >>> >>>> >>>> >I used the code and I get the Excel Running message, the basis of my code is > >Dim objExcel As Excel.Application >Dim objWB As Excel.Workbook > >Set objExcel = New Excel.Application >Set objWB = objExcel.Workbooks.Open(strProd) ' strProd is a string >containing the path to the workbook template. > >objExcel.Workbooks.Close >Set objWB = Nothing > >objExcel.Application.Quit >Set objExcel = Nothing > >And I have really tried every way I could think of of closing the workbook >and the application. Anyone know if I am closing the workbook and the >application incorrectly.. > >Paul Hartland > > > -- Marty Connelly Victoria, B.C. Canada