ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   object does not source automation events (https://www.excelbanter.com/excel-programming/337574-object-does-not-source-automation-events.html)

josh7

object does not source automation events
 
I am using visual basic 6.When I add a reference to Microsoft Excel 11.0
object library and run the program, it gives an error

Compile error: Object does not source automation events.

The programs works fine when the reference is removed.I am not sure why its
happening?




Chip Pearson

object does not source automation events
 
The first thing I would try is running Excel with the /regserver
switch, to instruct Excel to reset all its registry/typelib
information. With Excel closed, go to the Windows Start menu,
choose Run, and enter


Excel.exe /regserver

This will cause Excel to start, rewrite all of its registry
information, and then quit. Recompile your VB6 program.
--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"josh7" wrote in message
...
I am using visual basic 6.When I add a reference to Microsoft
Excel 11.0
object library and run the program, it gives an error

Compile error: Object does not source automation events.

The programs works fine when the reference is removed.I am not
sure why its
happening?






josh7

object does not source automation events
 
I am using the following statement in general declarations in vb 6.0

Private withevents ctrToolBar as Toolbar

I tried using Excel.exe /regserver but its still giving the same error


"Chip Pearson" wrote:

The first thing I would try is running Excel with the /regserver
switch, to instruct Excel to reset all its registry/typelib
information. With Excel closed, go to the Windows Start menu,
choose Run, and enter


Excel.exe /regserver

This will cause Excel to start, rewrite all of its registry
information, and then quit. Recompile your VB6 program.
--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"josh7" wrote in message
...
I am using visual basic 6.When I add a reference to Microsoft
Excel 11.0
object library and run the program, it gives an error

Compile error: Object does not source automation events.

The programs works fine when the reference is removed.I am not
sure why its
happening?







DM Unseen

object does not source automation events
 
Oops,

the Toolbar object has been discontinued from XL97 onwards, pls use the
more modern Commandbar object. It is only available in XL for backward
compatability.

Also the Toolbar object as given by XL typelib has no events(so
withevents would not make any sense), The Commandbar model has some btw
(for the individual controls and for the collection)

DM Unseen


josh7

object does not source automation events
 
The tool bar that i am using is from the windows common controls in vb 6 not
in excel.


DM Unseen

object does not source automation events
 
Then you have a typelib conflict!

pls prefix the Toolbar type definition with the actual typelib name to
distinguish it form the Toolbar object in the XL typelib(look it up in
the object browser)

e.g.

Private withevents ctrToolBar as MyTypelib.Toolbar

Dm Unseen


josh7

object does not source automation events
 
You are right,I am having a typelib conflict
Thank you,
Joshua



"DM Unseen" wrote:

Then you have a typelib conflict!

pls prefix the Toolbar type definition with the actual typelib name to
distinguish it form the Toolbar object in the XL typelib(look it up in
the object browser)

e.g.

Private withevents ctrToolBar as MyTypelib.Toolbar

Dm Unseen




All times are GMT +1. The time now is 05:16 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com