Hi Composer,
Montag, den 11 April 2005 schrieb Composer:
I would also like to try your other suggestion, having a class module
refer to my form and button using WithEvents. But how do I connect the
form to the class module when the form is opened?
I don't know a way to do that time. The only way I know is to develop a
system of 'withEvent' variables from the beginning of every outlook session
.... you spoke of so many code you wrote, so I imagine you should have such
system already.
To get aware of an item-open event you could instance inspectors objects
like
Private WithEvents mcolInsp As Outlook.Inspectors
Private WithEvents mobjInsp As Outlook.Inspector
After that you will find mcolInsp as an object at your class module and you
can write some code for the 'NewInspector' event of that object. So every
time you open any item that code will get triggered. For me that seems to
be right place to instance one more 'WithEvents' variable connecting to
your form like
Private Sub mcolInsp_NewInspector(ByVal Inspector As Inspector)
Set mobjInsp = Inspector
End Sub
The mobjInsp variable will give you some more events like 'Activate' you
have to use to keep control of the item you are using also contains your
command button ...
Or can the class
module refer to the form without regard to whether it's open or closed?
to control an item whether it's opened or closed you have to use explorers
selection event ...
And what is the name of a form which started as a delivered form but
to which I added a button?
Thanks again.
You'll see that I've posted another question about passing the Item
object from VBS to VBA and typecasting it to the correct type of item.
Perhaps you'll have some input there too?
sorry, I don't understand that question