is it posible to have an item change event in a public modual?

  • Thread starter Thread starter James
  • Start date Start date
J

James

is it posible to have an item change event in a public modual? i.e. i want
to detect if a user changes a field, but i want to run this from a modual,
not in the form.
 
On Mon, 8 Aug 2005 12:16:15 -0700 James wrote:

No, events can be received in class modules only. You could receive the
event and call a public method in the standard module.
 
oh, ok class's will do fine. do you know how i would reference a textbox
change event in a class? my form is a Business Contact Manager form if that
matters (they can't be modified, thats why i want to try to trap the event
some where else than behind the form.)
 
Am Tue, 9 Aug 2005 09:42:37 -0700 schrieb James:

James, you can´t trap TextBox_Change via the OOM. But what is about the
Item´s PropertyChange?
 
how do i use the item_propertyChange event for what i need?
public Item_PropertyChange(Name as what?)

select case would go here?

end sub
 
Am Tue, 9 Aug 2005 16:55:27 -0700 schrieb James:

The Name argument is a string and tells you what property has changed.

You need to trap the NewInspector event. Sample:

Private WithEvents m_colInspectors As Outlook.Inspectors
Private WithEvents m_oContact As Outlook.ContactItem

Private Sub Application_Startup()
Set m_colInspectors = Application.Inspectors
End Sub

Private Sub m_colInspectors_NewInspector(ByVal Inspector As
Outlook.Inspector)
Select Case True
Case (TypeOf Inspector.CurrentItem Is Outlook.ContactItem)
Set m_oContact = Inspector.CurrentItem
End Select
End Sub

Private Sub m_oContact_PropertyChange(ByVal Name As String)
'
End Sub
 
the Application_Startup() doesn't fire when i load outlook. do i have to do
anything else other than put your code in a class modual?
 
ok i got the startup sub to fire, i put it in the outlook session object.
however, the other subs don't seem to fire. i put them all in a class. do i
have to instance the class first then call the subs or somthing?
 
nm, its working now, all the subs go in the outlook session, i was listening
to another poster that said i need to use a class. Thank You so much! do you
know off hand how i can change it to make it only fire for a specific
folder? i know the folder name. "Business Contact Manager" and a sub folder
of "Business Contacts"
 
Am Wed, 10 Aug 2005 10:54:42 -0700 schrieb James:

That sample can handle one opened Inspector at once only. For more you´d
need an inspector wrapper and class modules, that´s correct.

In the NewInspector event you can check the ActiveExplorer.CurrentFolder
and decide whether to set the variable or not.
 
Thank You!


Michael Bauer said:
Am Wed, 10 Aug 2005 10:54:42 -0700 schrieb James:

That sample can handle one opened Inspector at once only. For more you´d
need an inspector wrapper and class modules, that´s correct.

In the NewInspector event you can check the ActiveExplorer.CurrentFolder
and decide whether to set the variable or not.
 
Back
Top