Ik had inderdaad de code die ik al had bij moeten voegen.
Ik ben vandaag even verder gegaan en nu werkt het
bijna.
Public Sub GetAllContactDetails()
Dim Session As Outlook.NameSpace
Dim currentExplorer As Explorer
Dim obj As Object
Dim DataObj As MSForms.DataObject
Dim strContactDetails As String
Set DataObj = New MSForms.DataObject
Set currentExplorer = Application.ActiveExplorer
Set obj = currentExplorer.Selection.Item(1)
If obj.Class = olContact Then
With obj
If .FullName <> "" Then strContactDetails = .FullName & vbCrLf
If .JobTitle <> "" Then strContactDetails = strContactDetails & .JobTitle & vbCrLf
If .Department <> "" Then strContactDetails = strContactDetails & .Department & vbCrLf
If .CompanyName <> "" Then strContactDetails = strContactDetails & .CompanyName & vbCrLf
If .MailingAddress <> "" Then strContactDetails = strContactDetails & .MailingAddress & vbCrLf
If .BusinessAddressCountry <> "" Then strContactDetails = strContactDetails & .BusinessAddressCountry & vbCrLf
If .BusinessTelephoneNumber <> "" Then strContactDetails = strContactDetails & "Business: " & .BusinessTelephoneNumber & vbCrLf
If .Business2TelephoneNumber <> "" Then strContactDetails = strContactDetails & "Business 2: " & .Business2TelephoneNumber & vbCrLf
If .CompanyMainTelephoneNumber <> "" Then strContactDetails = strContactDetails & "Company: " & .CompanyMainTelephoneNumber & vbCrLf
If .MobileTelephoneNumber <> "" Then strContactDetails = strContactDetails & "Mobile: " & .MobileTelephoneNumber & vbCrLf
If .Email1Address <> "" Then strContactDetails = strContactDetails & .Email1Address & vbCrLf
Dim objMsg As MailItem
Set objMsg = Application.CreateItem(olMailItem)
With objMsg
.Subject = "SVP terugbellen"
.Importance = olImportanceHigh
.Body = "Beste collega, " _
& vbNewLine & vbNewLine & _
"Graag even terugbellen. " & _
vbNewLine & vbNewLine & strContactDetails & _
vbNewLine & _
"Met vriendelijke groet," & _
vbNewLine & "Jeroen"
.Display
End With
Set objMsg = Nothing
End With
Else
MsgBox "You need to select a Contact."
End If
Set currentExplorer = Nothing
Set obj = Nothing
End Sub
Dit werkt bij een bestaand contact maar bij een nieuw contact werkt het niet. Ik heb geprobeerd om hem op te slaan en daarna het script uit te voeren maar dat gaat niet. Hij zal dus ge-refresht moeten worden denk ik. Maar dat krijg ik niet voor elkaar.
Oja Ik gebruik office 2010.