Weird behaviour when controlling Excel from Access/VBA

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I'm trying to use Automation to control Excel from Access.

So, first of all, what I am doing is that:

Dim appExcel As Excel.Application 'Global variable

Then, when clicking a button, this codes executes:

Set appExcel = New Excel.Application
appExcel.Visible = True


After that, a new Excel application opens.

Then, as a user, I close it! (File->Exit).

And then, when clicking another button, I try to execute this code:

appExcel.Visible = True

Here, the Excel Windows appears again (which shows that it hasn't been
closed when the user closed the window) but the problem here is that the
Excel Window, when appearing, is not filled with anything, we can see through
it and when dragging it, graphical bugs appear!

Why this behaviour? This is quite critical, because this would mean that an
application launched with Automation couldn't be monitored by the user?

I understand that when the user closes Excel, the process is still active,
because still referenced in the VBA code! But then, why isn't it working
normally when I make it visible again?

Thanks,

Lionel.
 
Hi,

Have you tried to use the method Quit? or to assign (set) the object
variable to Nothing.


Hoping it may help,
Vanderghast, Access MVP
 
Back
Top