The following code creates a calendar event for the contacts I select and adds each to the Subject field and shows the Full Names in the Note fields, but the If code only shows a mobile phone number in the Note field from one contact and not all the contacts I select which names are in the note fields....so is there away to adjust this so it shows the FullName of one Contact, and then the related fields to the contact and shows the same areas in the Note fields from the next contact that was selected....as this only recognizes a mobile phone field from one contact for purposes of showing it in the note field of the related calendar event.Sub Create_Calendar_Event_Selected_Contacts2()
Dim objApp As Application
Dim objNS As NameSpace
Dim objFolder As MAPIFolder
Dim objMsg As MailItem
Dim objItem As Object
Dim objItems As Object
Dim remoteObj
Dim strDynamicDL As String
Dim ContactName
Dim olns
Dim MyFolder
Dim NumItems
Dim myItem
Dim StartDateTime
Dim EndDateTime
Dim ShowAs
Dim itmAppt
Dim txtFullName
Dim txtMobile
Set oContact = objItem
Set objApp = CreateObject("Outlook.Application")
Set objNS = objApp.GetNamespace("MAPI")
Set objSelection = objApp.ActiveExplorer.Selection
For Each objItem In objSelection
If objItem.Class = olContact Then
strDynamicDL = strDynamicDL & objItem.FullName & (";")
Else
strDynamicDL = strDynamicDL & obj.DLName & (";")
End If
Next
ContactName = strDynamicDL & (";")
Set MyFolder = Session.GetDefaultFolder(9).Folders(2)
Set itmAppt = MyFolder.items.Add("IPM.Appointment.Office Calendar Event")
itmAppt.Subject = ContactName
For Each objItem In objSelection
If objItem.Class = olContact Then
itmAppt.Location = objItem.GetInspector.ModifiedFormPages("General").Controls("combobox12").Text
If objItem.GetInspector.ModifiedFormPages("General").Controls("FullName").Text <> "" Then txtFullName = "Full Name" & ": " & vbCrLf & objItem.GetInspector.ModifiedFormPages("General").Controls("FullName").Text & vbCrLf
If objItem.GetInspector.ModifiedFormPages("General").Controls("Phone4").Text <> "" Then txtMobile = "Mobile Number" & ": " & vbCrLf & objItem.GetInspector.ModifiedFormPages("General").Controls("Phone4").Text & vbCrLf
itmAppt.Body = "Full Name" & vbCrLf & strDynamicDL & vbCrLf & txtMobile
StartDateTime = objItem.GetInspector.ModifiedFormPages("General").Controls("OlkDateControl1").value & " " & objItem.GetInspector.ModifiedFormPages("General").Controls("OlkTimeControl1").Text
itmAppt.Start = StartDateTime
EndDateTime = objItem.GetInspector.ModifiedFormPages("General").Controls("OlkDateControl2").value & " " & objItem.GetInspector.ModifiedFormPages("General").Controls("OlkTimeControl2").Text
itmAppt.End = EndDateTime
ShowAs = objItem.GetInspector.ModifiedFormPages("General").Controls("combobox13").value
Select Case ShowAs
Case "Free"
ShowAs = 0
Case "Tentative"
ShowAs = 1
Case "Busy"
ShowAs = 2
Case "Out of Office"
ShowAs = 3
End Select
itmAppt.BusyStatus = ShowAs
itmAppt.Links.Add objItem
End If
Next
itmAppt.Display
Set objMsg = Nothing
Set objItem = Nothing
Set objFolder = Nothing
Set objNS = Nothing
Set objApp = Nothing
End Sub
Dim objApp As Application
Dim objNS As NameSpace
Dim objFolder As MAPIFolder
Dim objMsg As MailItem
Dim objItem As Object
Dim objItems As Object
Dim remoteObj
Dim strDynamicDL As String
Dim ContactName
Dim olns
Dim MyFolder
Dim NumItems
Dim myItem
Dim StartDateTime
Dim EndDateTime
Dim ShowAs
Dim itmAppt
Dim txtFullName
Dim txtMobile
Set oContact = objItem
Set objApp = CreateObject("Outlook.Application")
Set objNS = objApp.GetNamespace("MAPI")
Set objSelection = objApp.ActiveExplorer.Selection
For Each objItem In objSelection
If objItem.Class = olContact Then
strDynamicDL = strDynamicDL & objItem.FullName & (";")
Else
strDynamicDL = strDynamicDL & obj.DLName & (";")
End If
Next
ContactName = strDynamicDL & (";")
Set MyFolder = Session.GetDefaultFolder(9).Folders(2)
Set itmAppt = MyFolder.items.Add("IPM.Appointment.Office Calendar Event")
itmAppt.Subject = ContactName
For Each objItem In objSelection
If objItem.Class = olContact Then
itmAppt.Location = objItem.GetInspector.ModifiedFormPages("General").Controls("combobox12").Text
If objItem.GetInspector.ModifiedFormPages("General").Controls("FullName").Text <> "" Then txtFullName = "Full Name" & ": " & vbCrLf & objItem.GetInspector.ModifiedFormPages("General").Controls("FullName").Text & vbCrLf
If objItem.GetInspector.ModifiedFormPages("General").Controls("Phone4").Text <> "" Then txtMobile = "Mobile Number" & ": " & vbCrLf & objItem.GetInspector.ModifiedFormPages("General").Controls("Phone4").Text & vbCrLf
itmAppt.Body = "Full Name" & vbCrLf & strDynamicDL & vbCrLf & txtMobile
StartDateTime = objItem.GetInspector.ModifiedFormPages("General").Controls("OlkDateControl1").value & " " & objItem.GetInspector.ModifiedFormPages("General").Controls("OlkTimeControl1").Text
itmAppt.Start = StartDateTime
EndDateTime = objItem.GetInspector.ModifiedFormPages("General").Controls("OlkDateControl2").value & " " & objItem.GetInspector.ModifiedFormPages("General").Controls("OlkTimeControl2").Text
itmAppt.End = EndDateTime
ShowAs = objItem.GetInspector.ModifiedFormPages("General").Controls("combobox13").value
Select Case ShowAs
Case "Free"
ShowAs = 0
Case "Tentative"
ShowAs = 1
Case "Busy"
ShowAs = 2
Case "Out of Office"
ShowAs = 3
End Select
itmAppt.BusyStatus = ShowAs
itmAppt.Links.Add objItem
End If
Next
itmAppt.Display
Set objMsg = Nothing
Set objItem = Nothing
Set objFolder = Nothing
Set objNS = Nothing
Set objApp = Nothing
End Sub