Hi,

I have obtained some code to check for new emails in Micorosft Outlook.
VB Code:
  1. Dim olApp As Outlook.Application
  2.    Set olApp = CreateObject("Outlook.Application")
  3.    Dim olfolder As Outlook.MAPIFolder
  4.    
  5. Set olfolder = olApp.GetNamespace("MAPI").GetDefaultFolder(6)
  6. If olfolder.UnReadItemCount > 0 Then
  7. If olfolder.UnReadItemCount = 1 Then
  8. lblMail = "You have " & olfolder.UnReadItemCount & " New Email"
  9. Image2.Visible = True
  10. Else
  11. lblMail = "You have " & olfolder.UnReadItemCount & " New Emails"
  12. Image2.Visible = True
  13. End If
  14. Else
  15. lblMail = ""
  16. Image2.Visible = False
  17. End If

What I want to know is how can I make the program test to see whether Outlook is open or not becuase it is really annoying if you don't have it open and the program is attempting to check for new emails every minute and is startiing outlook automatically and slowing down your system.

Thanks