Digital-Inn
 
 

Go Back   Digital-Inn > Office-Welt > MS Outlook

MS Outlook Outlook . viel mehr als "nur" ein Mail-Programm.

Reply
 
Thread Tools Display Modes
Old 14-08-2008   #1
geckoo
Registered User
Board-Frischling
 

Join Date: Jan 2007
Location: Nürnberg
Posts: 5
Abgegebene Danke: 0
Erhielt 0 Danke für 0 Beiträge
Smile Frage - Empfänger auslesen - vba

hallo alle zusammen!!!

ich hab da ein problem. hab ein VBA-makro geschrieben, das einzelne emails in worddokument abspeichert. In diesem dokument wir der absender der email als "mailto" link hinterlegt. dies schaut so aus:

Code:
AbsName = OutlAktMail.SenderName
ReceivedName = OutlAktMail.ReceivedByName
TX_Empfaenger.Value = Replace(OutlAktMail.Recipients.Item(1).Name, "'", "")

' Zugriff über MAPI 
Set objCDO = CreateObject("MAPI.Session")
objCDO.Logon "", "", False, False   ' Anmeldung
Set objMsg = objCDO.GetMessage(OutlAktMail.EntryID)
Set objSender = objMsg.Sender

'Absender Emailadresse ermitteln
Const g_PR_SMTP_ADDRESS_W = &H39FE001F

For Each objMsg In objCDO
Debug.Print objMsg.Subject
AbsName2 = objMsg.Sender.Address
      If Not InStr(strAddress, "@") Then
         On Error Resume Next
         AbsName2 = objMsg.Sender.Fields(g_PR_SMTP_ADDRESS_W).Value
      End If
Next
so nun möchte ich das selbe für empfänger (an und cc) realisieren... hat jemand vielleicht eine idee??

geckoo
geckoo is offline   Reply With Quote
Sponsored Links
Old 14-08-2008   #2
bst
Excel Moderator
Senior Member (Board-Inventar)
 

Join Date: Oct 2004
Location: Ilsfeld
Posts: 2.466
Abgegebene Danke: 10
Erhielt 147 Danke für 145 Beiträge
Hi,

falls Dein OutlAktMail ein MailItem sein sollte gibt es da denn:

OutlAktMail.Cc
OutlAktMail.Bcc

cu, Bernd
bst is offline   Reply With Quote
Old 14-08-2008   #3
geckoo
Registered User
Board-Frischling
 

Join Date: Jan 2007
Location: Nürnberg
Posts: 5
Abgegebene Danke: 0
Erhielt 0 Danke für 0 Beiträge
Hi,

danke für die schnelle Antwort!

Den Namen des Empfängers krieg ich ja raus nur nicht die emailadresse...

und ja OutlAktMail ist ein MailItem...

geckoo
geckoo is offline   Reply With Quote
Old 14-08-2008   #4
bst
Excel Moderator
Senior Member (Board-Inventar)
 

Join Date: Oct 2004
Location: Ilsfeld
Posts: 2.466
Abgegebene Danke: 10
Erhielt 147 Danke für 145 Beiträge
Hi,

das sollte über OutlAktMail.Recipients funktionieren.

Ggf. musst Du dazu noch OutlAktMail.Recipients.ResolveAll aufrufen. Siehe VBA-Hilfe dazu. Sowas (schnell zusammengehackt) hat hier funktioniert.

cu, Bernd
--
Code:
Option Explicit

Sub x()
   Dim objItem As MailItem
   Dim myRecipients As Recipients
   Dim myRecipient As Recipient
   
   If Not ActiveInspector Is Nothing Then
      If TypeOf ActiveInspector.CurrentItem Is MailItem Then
         Set objItem = ActiveInspector.CurrentItem
         Set myRecipients = objItem.Recipients
         myRecipients.ResolveAll
         For Each myRecipient In myRecipients
            Debug.Print myRecipient.Name, myRecipient.Address
         Next
      End If
   End If
End Sub
bst is offline   Reply With Quote
Old 14-08-2008   #5
RO_SCH
Moderator
Senior Member (Board-Inventar)
 
RO_SCH's Avatar
 

Join Date: Aug 2006
Location: Nürnberg
Posts: 1.735
Abgegebene Danke: 8
Erhielt 115 Danke für 113 Beiträge
Hi,

könnte aber auch in deiner Art der Programmierung gehen in dem du einfach die korrekte Const für Sender_EMail_Address definierst und abfragst.

Const CdoPR_SENDER_EMAIL_ADDRESS = &H0C1F001F

PHP Code:
If Not InStr(strAddress"@"Then
         On Error Resume Next
         AbsName2 
objMsg.Sender.Fields(CdoPR_SENDER_EMAIL_ADDRESS)
      
End If 
__________________
Gruß Roland

Schaut auch hier mal rein: http://www.excel-werkstatt.de
RO_SCH is offline   Reply With Quote
Sponsored Links
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT +2. The time now is 03:31.


Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
SEO by vBSEO 2.4.0
Template-Modifikationen durch TMS
Advertisement System V2.5 By   Branden
Copyright by NightwoLF & Jesse69