![]() |
Recipient.Address in Exchange Server
TIA:
In earlier email I have following code: Sub Send_Attachment_Messages() Dim oFolder As Outlook.MAPIFolder Dim Items As Outlook.Items Dim objItem As MailItem Dim Recips As Recipients Dim Recip As Recipient Set Items = Application.GetNamespace("MAPI").GetDefaultFolder( olFolderOutbox).Items For Each objItem In Items Set Recips = objItem.Recipients For Each Recip In Recips If Recip.Address = " Then objItem.Attachments.Add ("C:\copper\115.xls") objItem.Send ElseIf Recip.Address = " Then objItem.Attachments.Add ("C:\copper\116.xls") objItem.Send ElseIf Recip.Address = " Then objItem.Attachments.Add ("C:\copper\118.xls") objItem.Send End If Next Next End Sub When I run code in Outlook on non Exchange Server compute all is fine. When I run code in Outlook that is networked with Excange Server, it doen't. Upon debug the Reciepient.Address value is something like "/o=Company/ou/SUBCOMPANY/cn=Main Office=JonesB" certainly not . When I type the value as "o/=Company..." in the If test in my code, it still doen't match the actual emails and thus nothing gets attached. One other fact..the email is generated from Word Mail Merge. I can see the values of EMail used by Word which is consistent with the data above "o/Company..." but in Step Mode of Outlook Recip.Address appears as CAPS but it is not that way in the Word Merge Data Table. Any ideas of what my code needs to be to match the EMail address as seen in the Outbox by my code. ie Recip.Address = "/o=Company/ou/SUBCOMPANY/cn=Main Office=JonesB" doen't work even though this is the value shown in Step Mode. Thanks very much, Joel |
Recipient.Address in Exchange Server
Well, if the comparison fails, you can output the values, e.g. using MsgBox,
right? First of all, e-mail adddress comparison should be cause insensitive. Secondly, what you are seeing is a perfectly valid EX type (as opposed to SMTP) address. Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "Joel" wrote in message ... TIA: In earlier email I have following code: Sub Send_Attachment_Messages() Dim oFolder As Outlook.MAPIFolder Dim Items As Outlook.Items Dim objItem As MailItem Dim Recips As Recipients Dim Recip As Recipient Set Items = Application.GetNamespace("MAPI").GetDefaultFolder( olFolderOutbox).Items For Each objItem In Items Set Recips = objItem.Recipients For Each Recip In Recips If Recip.Address = " Then objItem.Attachments.Add ("C:\copper\115.xls") objItem.Send ElseIf Recip.Address = " Then objItem.Attachments.Add ("C:\copper\116.xls") objItem.Send ElseIf Recip.Address = " Then objItem.Attachments.Add ("C:\copper\118.xls") objItem.Send End If Next Next End Sub When I run code in Outlook on non Exchange Server compute all is fine. When I run code in Outlook that is networked with Excange Server, it doen't. Upon debug the Reciepient.Address value is something like "/o=Company/ou/SUBCOMPANY/cn=Main Office=JonesB" certainly not . When I type the value as "o/=Company..." in the If test in my code, it still doen't match the actual emails and thus nothing gets attached. One other fact..the email is generated from Word Mail Merge. I can see the values of EMail used by Word which is consistent with the data above "o/Company..." but in Step Mode of Outlook Recip.Address appears as CAPS but it is not that way in the Word Merge Data Table. Any ideas of what my code needs to be to match the EMail address as seen in the Outbox by my code. ie Recip.Address = "/o=Company/ou/SUBCOMPANY/cn=Main Office=JonesB" doen't work even though this is the value shown in Step Mode. Thanks very much, Joel |
Recipient.Address in Exchange Server
Dmitry:
Yes, I can output in msgbox...I might also try LCase of Address to get out of case sensitivity. OK?? Joel "Dmitry Streblechenko" wrote: Well, if the comparison fails, you can output the values, e.g. using MsgBox, right? First of all, e-mail adddress comparison should be cause insensitive. Secondly, what you are seeing is a perfectly valid EX type (as opposed to SMTP) address. Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "Joel" wrote in message ... TIA: In earlier email I have following code: Sub Send_Attachment_Messages() Dim oFolder As Outlook.MAPIFolder Dim Items As Outlook.Items Dim objItem As MailItem Dim Recips As Recipients Dim Recip As Recipient Set Items = Application.GetNamespace("MAPI").GetDefaultFolder( olFolderOutbox).Items For Each objItem In Items Set Recips = objItem.Recipients For Each Recip In Recips If Recip.Address = " Then objItem.Attachments.Add ("C:\copper\115.xls") objItem.Send ElseIf Recip.Address = " Then objItem.Attachments.Add ("C:\copper\116.xls") objItem.Send ElseIf Recip.Address = " Then objItem.Attachments.Add ("C:\copper\118.xls") objItem.Send End If Next Next End Sub When I run code in Outlook on non Exchange Server compute all is fine. When I run code in Outlook that is networked with Excange Server, it doen't. Upon debug the Reciepient.Address value is something like "/o=Company/ou/SUBCOMPANY/cn=Main Office=JonesB" certainly not . When I type the value as "o/=Company..." in the If test in my code, it still doen't match the actual emails and thus nothing gets attached. One other fact..the email is generated from Word Mail Merge. I can see the values of EMail used by Word which is consistent with the data above "o/Company..." but in Step Mode of Outlook Recip.Address appears as CAPS but it is not that way in the Word Merge Data Table. Any ideas of what my code needs to be to match the EMail address as seen in the Outbox by my code. ie Recip.Address = "/o=Company/ou/SUBCOMPANY/cn=Main Office=JonesB" doen't work even though this is the value shown in Step Mode. Thanks very much, Joel |
Recipient.Address in Exchange Server
Yes, that should work.
Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "Joel" wrote in message ... Dmitry: Yes, I can output in msgbox...I might also try LCase of Address to get out of case sensitivity. OK?? Joel "Dmitry Streblechenko" wrote: Well, if the comparison fails, you can output the values, e.g. using MsgBox, right? First of all, e-mail adddress comparison should be cause insensitive. Secondly, what you are seeing is a perfectly valid EX type (as opposed to SMTP) address. Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "Joel" wrote in message ... TIA: In earlier email I have following code: Sub Send_Attachment_Messages() Dim oFolder As Outlook.MAPIFolder Dim Items As Outlook.Items Dim objItem As MailItem Dim Recips As Recipients Dim Recip As Recipient Set Items = Application.GetNamespace("MAPI").GetDefaultFolder( olFolderOutbox).Items For Each objItem In Items Set Recips = objItem.Recipients For Each Recip In Recips If Recip.Address = " Then objItem.Attachments.Add ("C:\copper\115.xls") objItem.Send ElseIf Recip.Address = " Then objItem.Attachments.Add ("C:\copper\116.xls") objItem.Send ElseIf Recip.Address = " Then objItem.Attachments.Add ("C:\copper\118.xls") objItem.Send End If Next Next End Sub When I run code in Outlook on non Exchange Server compute all is fine. When I run code in Outlook that is networked with Excange Server, it doen't. Upon debug the Reciepient.Address value is something like "/o=Company/ou/SUBCOMPANY/cn=Main Office=JonesB" certainly not . When I type the value as "o/=Company..." in the If test in my code, it still doen't match the actual emails and thus nothing gets attached. One other fact..the email is generated from Word Mail Merge. I can see the values of EMail used by Word which is consistent with the data above "o/Company..." but in Step Mode of Outlook Recip.Address appears as CAPS but it is not that way in the Word Merge Data Table. Any ideas of what my code needs to be to match the EMail address as seen in the Outbox by my code. ie Recip.Address = "/o=Company/ou/SUBCOMPANY/cn=Main Office=JonesB" doen't work even though this is the value shown in Step Mode. Thanks very much, Joel |
All times are GMT +1. The time now is 09:12 AM. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com