ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   FIX: Annoying inconsistent errors in Excel via Access automation (https://www.excelbanter.com/excel-programming/428755-re-fix-annoying-inconsistent-errors-excel-via-access-automation.html)

broro183[_116_]

FIX: Annoying inconsistent errors in Excel via Access automation
 

hi

Edit: Can you please amend your post to include Code tags (the hash
symbol above where you type your message) around your code?
End Edit

I can't tell from your partial code extract if you are already doing
what I'm about to suggest, but this may help remove the "phantom"
instances of Excel...

At the end of each macro, the memory should be released by setting your
object variables to nothing ie:
(assuming the same syntax in Access VBA as in Excel)


Code:
--------------------

Dim oXL As Object ' Excel.Application
Dim oWbk1 As Object ' Excel.Workbook
Dim oSht As Object 'Excel.Worksheet

'your code...

'free memory
set oSht = nothing
oWbk1.Save
oWbk1.Close
Set oWbk1 = nothing
'this should prevent the phantom appearances
oXL.quit
set oXL = nothing

--------------------


hth
Rob


--
broro183

Rob Brockett. Always learning & the best way to learn is to
experience...
------------------------------------------------------------------------
broro183's Profile: http://www.thecodecage.com/forumz/member.php?userid=333
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=13406



All times are GMT +1. The time now is 02:06 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com