Hooking into events raised by a latebound object

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

Guest

Hi,

I am trying to figure out if it is possible to hook into events of a latebound object, for instance say I had the following code:

Dim objExcel as Object
objExcel = createobject("Excel.Application")

How could I trap the application_beforerightclick event?. Early binding is not an option and I can not have a reference to excel inside my application.

Thanks for your help.

Regards.....Jim
 
Dim objExcel as Object
objExcel = createobject("Excel.Application")

How could I trap the application_beforerightclick event?. Early binding is not an option and I can not have a reference to excel inside my application.

Hi

Have a look at the AddHandler Statement:

AddHandler objExcel.BeforeRightClick, AddressOf MyRightClickHandler

Hope this helps

Blu
 
If your using Office 2003, then you can get hold of the Visual Studio Tools
For Office VSTO SDK which will allow you to do all manner of stuff like
this.

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing

jnc said:
Hi,

I am trying to figure out if it is possible to hook into events of a
latebound object, for instance say I had the following code:
Dim objExcel as Object
objExcel = createobject("Excel.Application")

How could I trap the application_beforerightclick event?. Early binding
is not an option and I can not have a reference to excel inside my
application.
 
Unfortunately this approach would require a reference to the excel object model. Anyone know of an approach where I would not have to reference excel?
 
Although it pains me to say it

Option Strict Off

will allow you to late bind the handler w/o a reference to the excel object
model. But, can you humour me and say why you can't have a reference?

Charles


jnc said:
Unfortunately this approach would require a reference to the excel object
model. Anyone know of an approach where I would not have to reference
excel?binding is not an option and I can not have a reference to excel inside my
application.
 
Back
Top