Try this:
It isn't clear whether or not you want to keep the new appointment within the Outlook Calendar, so I have provided code for both options - see the comments.Code:Option Explicit 'Requires reference to Microsoft Outlook Object Library Sub SetAppt() Dim olApp As Outlook.Application Dim olApt As AppointmentItem Set olApp = New Outlook.Application Set olApt = olApp.CreateItem(olAppointmentItem) With olApt .Start = Range("C25").Value .End = .Start + TimeValue("07:30:00") .Subject = Range("C24").Value .Location = Range("C26").Value .Body = "Don't forget to take an apple for the teacher" .BusyStatus = olBusy .ReminderMinutesBeforeStart = 4320 .ReminderSet = True .Display 'Save the iCalendar file in a known folder .SaveAs "C:\temp\excel\Outlook Appointment.ics" 'Use Close to retain the new appointment within the Outlook Calendar, or Delete to delete it. 'Both options keep the just-created .ics file .Close False '.Delete End With Set olApt = Nothing Set olApp = Nothing End Sub
Also, saving (the .SaveAs) causes an Outlook warning to be displayed. If you don't want this, the code can be easily tweaked to suppress this warning by using Outlook Redemption 'safe' objects.


LinkBack URL
About LinkBacks



Reply With Quote


Bookmarks