WebHosting

Showing posts with label Application.NewMail Event. Show all posts
Showing posts with label Application.NewMail Event. Show all posts

Tuesday, October 18, 2011

Application.NewMail Event


Public WithEvents myOlApp As Outlook.Application 
 
 
 
Sub Initialize_handler() 
 
 Set myOlApp = Outlook.Application 
 
End Sub 
 
 
 
Private Sub myOlApp_NewMail() 
 
 Dim myExplorers As Outlook.Explorers 
 
 Dim myFolder As Outlook.Folder 
 
 Dim x As Integer 
 
 Set myExplorers = myOlApp.Explorers 
 
 Set myFolder = myOlApp.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox) 
 
 If myExplorers.Count <> 0 Then 
 
 For x = 1 To myExplorers.Count 
 
 On Error GoTo skipif 
 
 If myExplorers.Item(x).CurrentFolder.Name = "Inbox" Then 
 
 myExplorers.Item(x).Display 
 
 myExplorers.Item(x).Activate 
 
 Exit Sub 
 
 End If 
 
skipif: 
 
 Next x 
 
 End If 
 
 On Error GoTo 0 
 
 myFolder.Display 
 
End Sub

Featured Posts

How to Enable and Configure Remote Desktop (RDP) on Ubuntu 24.04.4 LTS

Remote Desktop Protocol (RDP) support in Ubuntu has become considerably easier with the GNOME Remote Desktop stack included in modern Ubuntu...