Não consegui adicionar o anexo, com isso segue os comandos:
Para incluir o apontamento:
Private Sub Add_Record_Click()
' Use late binding to avoid the "Reference" issue
Dim olapp As Object ' Outlook.Application
Dim olappt As Object ' olAppointmentItem
If isAppThere("Outlook.Application") = False Then
' Outlook is not open, create a new instance
Set olapp = CreateObject("Outlook.Application")
Else
' Outlook is already open--use this method
Set olapp = GetObject(, "Outlook.Application")
End If
Set olappt = olapp.CreateItem(1) ' olAppointmentItem
With olappt
.Start = Nz(Me.eventstart, "") & " " & Nz(Me.time, "")
.duration = Nz(Me.duration, 0)
.subject = Nz(Me.subject, vbNullString)
.Mileage = Nz(Me.uniqueID, vbNullString)
.Location = "Aberdeen"
.Save
End With
' Release the Outlook object variables.
Set olappt = Nothing
Set olapp = Nothing ' Set chkAddedToOutlook to checked
Me.chkAddedtoOutlook = True
' Save the Current Record because we checked chkAddedToOutlook
'If Me.Dirty Then
'Me.Dirty = False
'End If
' Inform the user
MsgBox "Appointment Added!", vbInformation
End Sub
Para selecionar o apontamento: (não esta funcionando)
Private Sub Find_Record_Click()
' Use late binding to avoid the "Reference" issue
Dim objApp As Object ' Outlook.Application
Dim objAppt As Object ' olAppointmentItem
Set objNS = objAppt.GetNamespace("MAPI")
Set objRecip = objNS.CreateRecipient(strName)
Set objFolder = objNS.GetSharedDefaultFolder(objRecip, olFolderCalendar)
Dim sfilter As String
sfilter = "[Mileage] = " & Me.uniqueID & ""
Set objAppt = objFolder.Items.Find(sfilter) ' olAppointmentItem
With objAppt
Me.subject = .subject
.Save
End With
' Release the Outlook object variables.
Set olappt = Nothing
Set olapp = Nothing ' Set chkAddedToOutlook to checked
Me.chkAddedtoOutlook = True
' Save the Current Record because we checked chkAddedToOutlook
If Me.Dirty Then
Me.Dirty = False
End If
' Inform the user
MsgBox "Appointment Added!", vbInformation
End Sub
Abraço