I am trying to code a macro to automatically create an email to confirm an appointment from the details of the appointment made. When the appointment is selected or open the macro is run and the email populates with the information that I need. As part of the email I confirm the Appointment Location (either at the address specified in the location field or defaulting to our office address if the location field is left blank)

I have confirmed that the macro is returning the correct details by displaying them in a MsgBox, but I cannot get the macro to place the correct location address in the body of the email.

Can anybody help with where I am going wrong.

Public Sub Appointment_Confirmation()
Dim Item As AppointmentItem
Dim objMsg As MailItem
Dim AppointLocation As String
Set objMsg = Application.CreateItem(olMailItem)

Set Item = GetCurrentItem()

With objMsg
.Subject = "Appointment Confirmation - " & Item.Subject
.Body = "Hi " & Left$(Item.Subject, InStr(1, Item.Subject, " ") - 1) & "," & vbCrLf & _
"Appointment confirmed for " & Item.Start & vbCrLf & _
"Address: " & AppointLocation & vbCrLf & _
vbCrLf & _
"Regards," & vbCrLf & _
"My name" & vbCrLf & _
"My phone number"

If Len(Item.Location) <> 0 Then
AppointLocation = Item.Location
MsgBox AppointLocation
End If

If Len(Item.Location) = 0 Then
AppointLocation = "Office Address"
MsgBox AppointLocation
End If

.Display ' use .Send to send it instead
End With

Set objMsg = Nothing
Set Item = Nothing
AppointLocation = vbNullString

End Sub

Function GetCurrentItem() As Object
Dim objApp As Outlook.Application

Set objApp = Application
On Error Resume Next
Select Case TypeName(objApp.ActiveWindow)
Case "Explorer"
Set GetCurrentItem = objApp.ActiveExplorer.Selection.Item(1)
Case "Inspector"
Set GetCurrentItem = objApp.ActiveInspector.CurrentItem
End Select

Set objApp = Nothing
End Function