Tupacmoche
Registered User.
- Local time
- Today, 01:42
- Joined
- Apr 28, 2008
- Messages
- 291
Hi
I have an Access VB Function that creates appointments it was working fine and then started to fail with the message "User-defined type not defined' but I have not changed anything and can't find anything that is not defined. Can anyone see the problem in this code?
Public Function CreateAppointment(SubjectStr As String, BodyStr As String, RequiredAttendees As String, StartTime As Date, EndTime As Date, AllDay As Boolean)
Dim OlApp As Object 'Changed on 5-23 from Dim OlApp As Outlook.Application to 'Dim OlApp As Object
Dim oItem As Object 'Add on 5-23-17
Dim Appt As Outlook.AppointmentItem
Const olMailItem As Long = 0 'Added on 5-23-17
Set OlApp = CreateObject("Outlook.Application")
Set Appt = OlApp.CreateItem(olAppointmentItem)
Appt.MeetingStatus = olMeeting
Appt.RequiredAttendees = RequiredAttendees
Appt.Subject = SubjectStr
Appt.Start = StartTime
Appt.End = EndTime
Appt.AllDayEvent = AllDay
Appt.BOdy = BodyStr
Appt.Display
Appt.Save
'Appt.Send
Set Appt = Nothing
Set OlApp = Nothing
End Function
I have an Access VB Function that creates appointments it was working fine and then started to fail with the message "User-defined type not defined' but I have not changed anything and can't find anything that is not defined. Can anyone see the problem in this code?
Public Function CreateAppointment(SubjectStr As String, BodyStr As String, RequiredAttendees As String, StartTime As Date, EndTime As Date, AllDay As Boolean)
Dim OlApp As Object 'Changed on 5-23 from Dim OlApp As Outlook.Application to 'Dim OlApp As Object
Dim oItem As Object 'Add on 5-23-17
Dim Appt As Outlook.AppointmentItem
Const olMailItem As Long = 0 'Added on 5-23-17
Set OlApp = CreateObject("Outlook.Application")
Set Appt = OlApp.CreateItem(olAppointmentItem)
Appt.MeetingStatus = olMeeting
Appt.RequiredAttendees = RequiredAttendees
Appt.Subject = SubjectStr
Appt.Start = StartTime
Appt.End = EndTime
Appt.AllDayEvent = AllDay
Appt.BOdy = BodyStr
Appt.Display
Appt.Save
'Appt.Send
Set Appt = Nothing
Set OlApp = Nothing
End Function