PDA

Click to See Complete Forum and Search --> : ThisOutlookSession and Global Variables


Shevy
Jul 23rd, 2003, 10:25 AM
I am writing a VBA app for Outlook and I have declared a global variable at the top of the ThisOutlooksession object code as follows:

Public WithEvents oMailItem As Outlook.MailItem

when I try to access oMailItem in a form which is part of the project I get an error 'Object undefined'. What am I doing wrong?
shouldnt the variable be available if it is declared as global??
I would appreciate any help with this.

lintz
Jul 23rd, 2003, 11:37 PM
One option would be to put your declaration in a module. I use a module to declare Excel and it works fine. Hope this helps.....

Shevy
Jul 24th, 2003, 08:11 AM
Can you give me more detail? I am not so familiar with VBA. How do I make a module??

lintz
Jul 24th, 2003, 08:53 AM
Open your project and click Project --> Add Module and then enter your code.

Shevy
Jul 24th, 2003, 10:51 AM
How do I know this code will run?
when does it run?
Thanks.