PC Review
Forums
Newsgroups
Microsoft Outlook
Microsoft Outlook VBA Programming
Re: Help w/Redemption.
Forums
Newsgroups
Microsoft Outlook
Microsoft Outlook VBA Programming
Re: Help w/Redemption.
![]() |
Re: Help w/Redemption. |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
Your code works just fine for me. It looks like you are calling
R_GetSenderAddress() function, but you never assign its return value to a variable. Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "crappybottom" <crappy@inmypants.com> wrote in message news:vn1e13koc83100@corp.supernews.com... > Hello all, > Below is a snippet of code that I am using to "get" the smtp addy of > selected email(s). > Problem is, it is returning the subject line. > Where the line: > R_GetSenderAddress (objItem) > is, is where I will capturing the SMTP addy and writing it directly to our > GFI blacklist > database. That code is done, this is the last step. > > I am new to Outlook VBA, can someone pitch in and help ? > Thanks. > > Function R_GetSenderAddress(objMsg) > Dim strType > Dim objSenderAE > Dim objSMail > Const PR_SENDER_ADDRTYPE = &HC1E001E > Const PR_EMAIL = &H39FE001E > > Set objSMail = CreateObject("Redemption.SafeMailItem") > objSMail.Item = objMsg > strType = objSMail.Fields(PR_SENDER_ADDRTYPE) > > Set objSenderAE = objSMail.Sender > If Not objSenderAE Is Nothing Then > If strType = "SMTP" Then > R_GetSenderAddress = objSenderAE.Address > ElseIf strType = "EX" Then > R_GetSenderAddress = objSenderAE.Fields(PR_EMAIL) > End If > End If > > Set objSenderAE = Nothing > Set objSMail = Nothing > > End Function > > Sub Unsolicited() > Dim objApp As Application > Dim objSelection As Selection > Dim objItem As Object > > Set objApp = CreateObject("Outlook.Application") > Set objSelection = objApp.ActiveExplorer.Selection > > Select Case objSelection.Count > > Case 0 > Case Is > 1 > For Each objItem In objSelection > If TypeOf objItem Is MailItem Then > R_GetSenderAddress (objItem) > 'do more stuff later > End If > Next > 'SendKeys "{DELETE}" > Case Is <= 1 > For Each objItem In objSelection > If TypeOf objItem Is MailItem Then > R_GetSenderAddress (objItem) > 'do more stuff later > End If > Next > End Select > > Set objApp = Nothing > Set objSelection = Nothing > Set objItem = Nothing > End Sub > > |
|
|
|
#2 |
|
Guest
Posts: n/a
|
uhhh. whoops
![]() "Dmitry Streblechenko" <dmitry@dimastr.com> wrote in message news:eYCthxhgDHA.3104@TK2MSFTNGP11.phx.gbl... > Your code works just fine for me. It looks like you are calling > R_GetSenderAddress() function, but you never assign its return value to a > variable. > |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 


