Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default ReferencesEvents

Hi,

Does anybody know about using ReferencesEvents ?

I've tried using the sample from VBA Help but it doesn't work .I made a

class module and in a standard module I declare the variable.

My code below

in a class module named Class1

Public WithEvents X As VBIDE.ReferencesEvents
Private Sub Class_Initialize()

MsgBox "initialized"

End Sub
Private Sub Class_Terminate()

MsgBox "over"

End Sub
Private Sub X_ItemAdded(ByVal Reference As VBIDE.Reference)
MsgBox Reference.Name
End Sub
Private Sub X_ItemRemoved(ByVal Reference As VBIDE.Reference)
MsgBox "tata"
End Sub

In a standard module

Dim TT As New Class1
Sub ff()

Set TT.X =
Application.VBE.Events.ReferencesEvents(ThisWorkbo ok.VBProject)

End Sub

Every time I add or remove a reference, I should have the messages I
put
into the subs X_ItemAdded or X_ItemRemoved but I get neither of these.

Moreover, what it's really strange, when I add a reference, I get the
message of Sub Class_Initialize ( which is quite normal anyway
according
to the declarations I made ) but when I remove the same reference
immediately after , I get the message of Sub Class_Terminate which I
find odd to get , in that case.
I can't happen fixing the problem

Could anybody help please ?

Regards

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
ReferencesEvents anonymousA Excel Programming 0 October 1st 05 04:24 PM


All times are GMT +1. The time now is 06:05 AM.

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

About Us

"It's about Microsoft Excel"