Sinking events for late bound objects ?

Jaafar Tribak

Well-known Member
Joined
Dec 5, 2002
Messages
9,596
Office Version
  1. 2016
Platform
  1. Windows
Hi there.

I don't think this is even possible but it won't hurt to ask .

Can we sink events of a late bound object ie :an Object accessed/automated via the CreateObject function and therefore without being able to use the WithEvents keyword ?

For example : Use Createobject to create a new instance of a Word document and somehow capture the Word document events from excel.
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Totally late-bound in the sense that the project contains no references to the Word object library in this case?
 
Upvote 0
Totally late-bound in the sense that the project contains no references to the Word object library in this case?

Yes Greg. No reference to the library of the automated object thus the impossibility to use the WithEvents keyword. - Thank you.
 
Upvote 0
Hope this will help.

Thanks Sektor - will take a close look.

I've actually already done some googling before asking here but only found code in languages other than VB and/or code that needs third party components.
 
Upvote 0
I have found this link in 10 seconds. This depends on what you're typing in text box. ;)
 
Upvote 0
Ok- In case anyone is interested and want to venture into some low level COM, here is some amazing code I found in <cite>planet-source-code</cite> which implements the low level COM interfaces IConnectionPoint or IDispatch using plain VBA - No addintional components needed.

The code I found was for sinking events for IExplorer but I adapted it to sink events for excel .

here is a workbook demo.
 
Upvote 0
At this point I haven't any need to do this. But rest assured I have downloaded the workbook just in case I ever need to try something along these lines.
 
Upvote 0

Forum statistics

Threads
1,214,585
Messages
6,120,390
Members
448,957
Latest member
Hat4Life

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top