Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default class events stop firing with ADO 2.8

Excel add-in has been working for 2 years using ado 2.7; it fails on ado 2.8.
Here's stripped down version that displays message boxes for all events used.
This test works on ado 2.7. It has a reference to "Microsoft ADO Ext.2.7. for
DDL and Security". I load this Add-in programmatically. All events fire as
expected.

Now when i use this same Add-in on a system with ADO 2.8 {in my test case XP
SP2} it begins ok. The FIRST, SECOND and THIRD EVENT occur correctly then the
events no longer fire. For example the right-click does not occur, etc. If i
change the ado reference to "Microsoft ADO Ext.2.8. for DDL and Security". It
works fine... events continue to fire.

I can cheat and have two Add-ins; one with ado 2.7 and one with 2.8. There
has to be a better way. Can you input?



--------------------------------------------------------------------------------

'***EXCEL WORKBOOK OF ADD-IN***
Option Explicit
Dim AppClass As New AppEventClass

Public Sub Workbook_Open()
MsgBox ("Public Sub Workbook_Open() FIRST EVENT")
Set AppClass.App = Application
End Sub

--------------------------------------------------------------------------------

'***AppEventClass - an Excel VBA class module***
Option Explicit
Public WithEvents App As Application

Private Sub app_SheetBeforeRightClick(ByVal Sh As Object, ByVal Target As
Range, Cancel As Boolean)
MsgBox ("Private Sub app_SheetBeforeRightClick RIGHT CLICK")
End Sub

Private Sub App_SheetActivate(ByVal Sh As Object)
MsgBox ("Private Sub App_SheetActivate(ByVal Sh As Object)")
End Sub

Private Sub App_WorkbookAddinUninstall(ByVal Wb As Workbook)
On Error Resume Next
MsgBox ("Private Sub App_WorkbookAddinUninstall(ByVal Wb As Workbook)")
Call removeMe(Wb.Name)
End Sub

Private Sub App_WorkbookBeforeSave(ByVal Wb As Workbook, ByVal SaveAsUI As
Boolean, Cancel As Boolean)
On Error Resume Next
MsgBox ("Private Sub App_WorkbookBeforeSave")
End Sub

Private Sub App_WorkbookDeactivate(ByVal Wb As Workbook)
MsgBox ("Private Sub App_WorkbookDeactivate(ByVal Wb As Workbook) NAME =
" & Wb.Name)
If Wb.Name = Workbooks.Item(1).Name Then Call removeMe(Wb.Name)
End Sub

Private Sub removeMe(removing As String)
MsgBox ("Private Sub removeMe() " & removing)
End Sub

Private Sub App_WorkbookOpen(ByVal Wb As Workbook)
MsgBox ("Private Sub App_WorkbookOpen(ByVal Wb As Workbook) " & Wb.Name
& " THIRD EVENT")
End Sub

Private Sub Class_Initialize()
MsgBox ("Private Sub Class_Initialize() SECOND EVENT")
End Sub


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default class events stop firing with ADO 2.8

Check your references in VBE.

if ANY reference is listed as ISMISSING this may well cause the hiccup.





--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


ThankYou_jeff wrote :

Excel add-in has been working for 2 years using ado 2.7; it fails on
ado 2.8. Here's stripped down version that displays message boxes
for all events used. This test works on ado 2.7. It has a reference
to "Microsoft ADO Ext.2.7. for DDL and Security". I load this Add-in
programmatically. All events fire as expected.

Now when i use this same Add-in on a system with ADO 2.8 {in my test
case XP SP2} it begins ok. The FIRST, SECOND and THIRD EVENT occur
correctly then the events no longer fire. For example the right-click
does not occur, etc. If i change the ado reference to "Microsoft ADO
Ext.2.8. for DDL and Security". It works fine... events continue to
fire.

I can cheat and have two Add-ins; one with ado 2.7 and one with 2.8.
There has to be a better way. Can you input?



----------------------------------------------------------------------
----------

'***EXCEL WORKBOOK OF ADD-IN***
Option Explicit
Dim AppClass As New AppEventClass

Public Sub Workbook_Open()
MsgBox ("Public Sub Workbook_Open() FIRST EVENT")
Set AppClass.App = Application
End Sub

----------------------------------------------------------------------
----------

'***AppEventClass - an Excel VBA class module***
Option Explicit
Public WithEvents App As Application

Private Sub app_SheetBeforeRightClick(ByVal Sh As Object, ByVal
Target As Range, Cancel As Boolean)
MsgBox ("Private Sub app_SheetBeforeRightClick RIGHT CLICK")
End Sub

Private Sub App_SheetActivate(ByVal Sh As Object)
MsgBox ("Private Sub App_SheetActivate(ByVal Sh As Object)")
End Sub

Private Sub App_WorkbookAddinUninstall(ByVal Wb As Workbook)
On Error Resume Next
MsgBox ("Private Sub App_WorkbookAddinUninstall(ByVal Wb As
Workbook)") Call removeMe(Wb.Name)
End Sub

Private Sub App_WorkbookBeforeSave(ByVal Wb As Workbook, ByVal
SaveAsUI As Boolean, Cancel As Boolean)
On Error Resume Next
MsgBox ("Private Sub App_WorkbookBeforeSave")
End Sub

Private Sub App_WorkbookDeactivate(ByVal Wb As Workbook)
MsgBox ("Private Sub App_WorkbookDeactivate(ByVal Wb As Workbook)
NAME = " & Wb.Name)
If Wb.Name = Workbooks.Item(1).Name Then Call removeMe(Wb.Name)
End Sub

Private Sub removeMe(removing As String)
MsgBox ("Private Sub removeMe() " & removing)
End Sub

Private Sub App_WorkbookOpen(ByVal Wb As Workbook)
MsgBox ("Private Sub App_WorkbookOpen(ByVal Wb As Workbook) " &
Wb.Name & " THIRD EVENT")
End Sub

Private Sub Class_Initialize()
MsgBox ("Private Sub Class_Initialize() SECOND EVENT")
End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default class events stop firing with ADO 2.8

Thanks but there are no missing references; other than perhaps the "MS ADO
Ext.2.7 for DLL and Security" which is automatically updated to "MS ADO
Ext.2.8 for DLL and Security" when the Add-in is manually opened in the VB
IDE [Alt-F11]. Once that reference is replaced the Add-in works for ADO 2.8.
Then, of course, the Add-in will not work at all for ADO 2.7 {since "MS ADO
Ext.2.8 for DLL and Security" is truely missing. VB IDE won't automatically
downgrade to 2.7}.

"keepITcool" wrote:

Check your references in VBE.

if ANY reference is listed as ISMISSING this may well cause the hiccup.





--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


ThankYou_jeff wrote :

Excel add-in has been working for 2 years using ado 2.7; it fails on
ado 2.8. Here's stripped down version that displays message boxes


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default class events stop firing with ADO 2.8


so.. you do have a referencing problem...

also your use of ADO and ADOX is confusing.
ADO would be Microsoft ActiveX Data Objects 2.8 Library
ADOX would be MS ADO Ext.2.8 for DLL and Security

First you'd need to save the addin when the references
both to ADO and ADOX are in sync, and to the "lowest" possible version.


Perhaps it's an idea to rewrite all adox calls/object
to LATEBOUND, and remove all adox references.
(although this would mean a performance loss when objects are created,

I assume you wouldnt have that many adox calls,most of what you can do
with ADOX you can do with ADO's openschema and generally faster too.


Changing code to "late-binding":

Change all 'typed' adox object declarations to OBJECT

Change lines like
set adoxCAT = new adox.catalog
to
set adoxCAT = createobject("adox.catalog")

Change
all adox constants
to
their numeric values.

HTH


--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


ThankYou_jeff wrote :

Thanks but there are no missing references; other than perhaps the
"MS ADO Ext.2.7 for DLL and Security" which is automatically updated
to "MS ADO Ext.2.8 for DLL and Security" when the Add-in is manually
opened in the VB IDE [Alt-F11]. Once that reference is replaced the
Add-in works for ADO 2.8. Then, of course, the Add-in will not work
at all for ADO 2.7 {since "MS ADO Ext.2.8 for DLL and Security" is
truely missing. VB IDE won't automatically downgrade to 2.7}.

"keepITcool" wrote:

Check your references in VBE.

if ANY reference is listed as ISMISSING this may well cause the
hiccup.





--
keepITcool
www.XLsupport.com | keepITcool chello nl | amsterdam



ThankYou_jeff wrote :

Excel add-in has been working for 2 years using ado 2.7; it fails
on ado 2.8. Here's stripped down version that displays message
boxes

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default class events stop firing with ADO 2.8

Right on the money... had references "Microsoft ActiveX Data Objects 2.6
Library" and "Microsoft ADO Ext.2.7 for DLL and Security". Changed to ADO 2.7
and tossed ADOX; now works on both ado 2.7 and 2.8.


"keepITcool" wrote:


so.. you do have a referencing problem...

also your use of ADO and ADOX is confusing.
ADO would be Microsoft ActiveX Data Objects 2.8 Library
ADOX would be MS ADO Ext.2.8 for DLL and Security

First you'd need to save the addin when the references
both to ADO and ADOX are in sync, and to the "lowest" possible version.


Perhaps it's an idea to rewrite all adox calls/object
to LATEBOUND, and remove all adox references.
(although this would mean a performance loss when objects are created,

I assume you wouldnt have that many adox calls,most of what you can do
with ADOX you can do with ADO's openschema and generally faster too.


Changing code to "late-binding":

Change all 'typed' adox object declarations to OBJECT

Change lines like
set adoxCAT = new adox.catalog
to
set adoxCAT = createobject("adox.catalog")

Change
all adox constants
to
their numeric values.

HTH


--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


ThankYou_jeff wrote :

Thanks but there are no missing references; other than perhaps the
"MS ADO Ext.2.7 for DLL and Security" which is automatically updated
to "MS ADO Ext.2.8 for DLL and Security" when the Add-in is manually
opened in the VB IDE [Alt-F11]. Once that reference is replaced the
Add-in works for ADO 2.8. Then, of course, the Add-in will not work
at all for ADO 2.7 {since "MS ADO Ext.2.8 for DLL and Security" is
truely missing. VB IDE won't automatically downgrade to 2.7}.

"keepITcool" wrote:

Check your references in VBE.

if ANY reference is listed as ISMISSING this may well cause the
hiccup.





--
keepITcool
www.XLsupport.com | keepITcool chello nl | amsterdam


ThankYou_jeff wrote :

Excel add-in has been working for 2 years using ado 2.7; it fails
on ado 2.8. Here's stripped down version that displays message
boxes




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to prevent BeforeCloseEvent firing more than once. Daffo Excel Discussion (Misc queries) 3 October 16th 06 02:32 PM
Events, Class, Time Editing Dave Excel Programming 1 October 4th 04 11:06 PM
Events firing willy nilly Darren Hill[_2_] Excel Programming 4 January 23rd 04 10:00 PM
RaiseEvent from a class contained in a 2nd class collection? Andrew[_16_] Excel Programming 2 January 6th 04 04:22 PM
What events can be captured in a Class Module? Tom Ogilvy Excel Programming 4 September 8th 03 05:41 AM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"