View Single Post
  #1 (permalink)  
Old March 31st, 2012, 09:02 AM
dLRam dLRam is offline
Registered User
Points: 5, Level: 1
Points: 5, Level: 1 Points: 5, Level: 1 Points: 5, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Mar 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Sub or Function not defined

I am new to VBA and I have read “outlook 2007 programming”. When I run the code below (the code is from the book) I receive a compile error, "Sub or Function not defined." And the “Public Sub AddRecipient()” gets Highlighted. Also “SetDefaultDisplayMode_” is highlighted with a blue background. Can someone tell me what the problem may be?

Public Sub AddRecipient()
 Dim oSelect As Outlook.SelectNamesDialog
 Dim colRecipients As Outlook.Recipients
 Dim oRecip As Outlook.Recipient
 Dim oMail As Outlook.MailItem
 Set oMail = Application.CreateItem(olMailItem)
 Set oSelect = Application.Session.GetSelectNamesDialog
 With oSelect
  .AllowMultipleSelection = False
  SetDefaultDisplayMode _
   .ForceResolution = True
   .Caption = "My Mail Selector Dialog"
   .ToLabel = "My To Selector"
   .NumberOfRecipientSelectors = _
   If .Recipients.Count = 1 Then
     Set oRecip = _
   End If
End With
End Sub]

Thank you in advance for your help
Reply With Quote