How to get an related Contact Object from an Appointment

C

Christian Müller

Hello VBA Family,

I want to write an automated Bill from an Appointment.
It`s works well.
Word get`s all Information from Outlook also the Contact because their is a
Link in the Appointment.
Bad is that I get the Contact as String so when I use restrict it only get
right when the Contact Name is not doubled.
Is there a Method so I can get the Link as Object so that is always right ?
So as the doubleclick in the Appointment always get the related Contact ?

Thanks for your help, sorry about my englisch

Christian


----
Code :

Sub KontaktVonTerminErmitteln()
Set objSelection = Application.ActiveExplorer.Selection
strKontaktname = objSelection(1).Links(1).Name
Dim olOrdner As Outlook.MAPIFolder
Dim olKontakte As Outlook.Items
Dim olKontakt As Outlook.ContactItem
Set olAnw = GetObject(, "Outlook.Application")
'Kontakte-Ordner setzen
Set olOrdner = olAnw.Session.GetDefaultFolder(olFolderContacts)
Set olKontakte = olOrdner.Items
'Scan ansetzen
Set olKontakte = olKontakte.Restrict("[Name] = " & strKontaktname & "")
If olKontakte.Count = 0 Then
MsgBox "Es wurde keine Entsprechung gefunden."
Exit Sub
End If
If olKontakte.Count <> 1 Then
MsgBox "Mehr als ein Kontakt"
End If
Set Kontakt = olKontakte(1)
End Sub
 
M

Michael Bauer

Hi Christian,

the Link object has an Item property, which should be what you´re
looking for.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top