p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Professional Outlook 2007 Programming ISBN: 978-0-470-04994-5 (http://p2p.wrox.com/forumdisplay.php?f=363)
-   -   Sub or Function not defined (http://p2p.wrox.com/showthread.php?t=87144)

dLRam March 31st, 2012 09:02 AM

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

All times are GMT -4. The time now is 05:58 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.