Excel events implemented in Access

J

Jess

I have an access application which creates an excel sheet from scratch. How I
can implement excel events in access? For instance: How can I implement the
Worksheet_SelectionChange event in access? My guess is that this event cannot
be implemented in excel because the access generates my excel sheet from
scratch.

Any help is welcome

Thanks
 
B

Banana

I've not done it personally but I'm fairly sure you can do so, provided
you meet some prerequisites.

First, the code has to be in a class module. Can be a form as it's a
class or a standalone class module.

Second, you need a variable for the Excel objects (e.g. Application,
Workbook, Worksheet) with the keyword WithEvent declared.

Example:

Private WithEvents xlApp As Excel.Application

Thirdly, you need to declare a event handler for the variable. This can
be done by selecting xlApp from the left combobox on top of the code
windows, then choosing the desired event on right combobox.

I'm not sure if this can be done with late binding, though.
 
D

David H

What are you trying to do and what specific 'Events' are you referring to?

You can fully automate Excel from Access.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top