SOLVED
Hi All,
I have recently upgraded my machine to Windows 10, and now I'm having issues getting some VBA code within Access 2003 to work. It has ran fine for the last 4 years and since upgraded to Win10 it no longer works.
The code simply posts an appointment into a Public Folder Calendar - there is more to the actual function but i have narrowed it down to the actual creation of the appointment.
Please see code below:
Please note that it brings up an error "Method 'Items' of object 'MAPIFolder' failed" on the following line:
Please note that this code will execute fine from within Outlook itself, but while ran from Access no luck.
Thanks for any help!
Hi All,
I have recently upgraded my machine to Windows 10, and now I'm having issues getting some VBA code within Access 2003 to work. It has ran fine for the last 4 years and since upgraded to Win10 it no longer works.
The code simply posts an appointment into a Public Folder Calendar - there is more to the actual function but i have narrowed it down to the actual creation of the appointment.
Please see code below:
Code:
Public Sub PostLeave()
Dim olfolder As Outlook.MAPIFolder
Dim olapp As Outlook.Application
Dim olAppt as Outlook.AppointmentItem
Set olapp = CreateObject("Outlook.Application.14")
Set olfolder = olapp.GetNamespace("Mapi").GetFolderFromID("000000001A447390AA6611CD9BC800AA002FC45A030018E43B268190ED4FAB3F96CD9EC40DAE006E10F9C07E0000")
[B]Set olAppt = olfolder.Items.Add(1)[/B]
With olAppt 'olAppointmentItem
.AllDayEvent = True
.start = "29/06/2016 13:00:00"
.End = "29/06/2016 14:00:00"
.Subject = "TEST LEAVE FUNCTION"
.Save
End With
Set olfolder = Nothing
Set olapp = Nothing
End Sub
Code:
Set olAppt = olfolder.Items.Add(1)
Thanks for any help!
Last edited: