Trap/Answer Excel Messages from Access?

  • Thread starter Thread starter LarryP
  • Start date Start date
L

LarryP

I have numerous Excel source files that all contain
autoexec code to tell the user the age of the file and ask
him to confirm he still wants to open it. That needs to
stay in effect when any one opens the file directly.

However, I also tap into these files programmatically from
Access, and would like to know how to eliminate those
prompts -- presumably, by trapping them somehow so they
don't pop up on screen, then sending the "Yes" answer from
code. Anybody know how?
 
Larry:

There's no real way to trap an auto exec message boxes and respond them
other than a nasty send keys routine. However, if you control the Excel
files and can modify the auto exec, there's a reasonably simple work around.
That being you add to the auto exec a simple qualifier for the message box,
being:

If Application.Visible = True Then
'Run the message box
End if

Then when using Automation from Access, simply set the Excel object's
visible property to false when you instantiate it before you open the file
and that should solve the problem.

HTH
 
OK, thanks, I'll look into that. Have to think my way
through whether any of my Access-based processes require
the Excel application/workbook to be visible.
 
Back
Top