Results 1 to 5 of 5

Thread: ThisOutlookSession and Global Variables

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 2003
    Posts
    232

    ThisOutlookSession and Global Variables

    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.

  2. #2
    PowerPoster lintz's Avatar
    Join Date
    Mar 2003
    Location
    The 19th Hole
    Posts
    2,697
    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.....

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jul 2003
    Posts
    232

    ThisOutlookSession and Global Variables

    Can you give me more detail? I am not so familiar with VBA. How do I make a module??

  4. #4
    PowerPoster lintz's Avatar
    Join Date
    Mar 2003
    Location
    The 19th Hole
    Posts
    2,697
    Open your project and click Project --> Add Module and then enter your code.

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Jul 2003
    Posts
    232

    ThisOutlooksession global variables

    How do I know this code will run?
    when does it run?
    Thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width