I got this code for this web site. When I run it, I get User-defined type not defined. And objOutlook As Outlook.Application is highlighted. I am using Access 2003. Any help would be appreciated.
Code:
Private Sub Command0_Click()
On Error GoTo Add_Err
DoCmd.RunCommand acCmdSaveRecord
Dim objOutlook As Outlook.Application
Dim objAppt As Outlook.AppointmentItem
Dim objRecurPattern As Outlook.RecurrencePattern
Set objOutlook = CreateObject("Outlook.Application")
Set objAppt = objOutlook.CreateItem(olAppointmentItem)
With objAppt
.Start = #4/14/2004 10:00:00 AM# 'Me!FOLLOWUPCALLBACK & " " & Me!FOLLOWUPCALLBACK_TIME
.Subject = "Test" 'Me!Company & " - " & Me!NEXTACTION
.Duration = 90
.ReminderSet = True
.ReminderMinutesBeforeStart = 15
.Save
.Close (olSave)
End With
Set objAppt = Nothing
Set objOutlook = Nothing
DoCmd.RunCommand acCmdSaveRecord
MsgBox "Appointment Added!"
Exit Sub
Add_Err:
MsgBox "Error " & Err.Number & vbCrLf & Err.Description
End Sub