Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Updating Outlook Calendar from Excel
Hi All,
I am using the following code to add an appointment to Outlook from Excel: Sub AddAppointmentsToCalendar() Dim OLF As Outlook.MAPIFolder, objItem As Outlook.AppointmentItem Dim i As Long, lngItemCount As Long, r As Long On Error Resume Next Set OLF = GetObject("", "Outlook.Application").GetNamespace("MAPI").GetDef aultFolder(olFolderCalendar) On Error GoTo 0 If OLF Is Nothing Then Exit Sub ' Outlook not available Application.StatusBar = "Adding appointments to Outlook..." With wsSheet1 ' the worksheet with the new appointments .Activate r = Range("NewAppointments").Row + 1 ' the first row with data Do While Len(Range("A" & r).Formula) 0 On Error Resume Next Set objItem = OLF.Items.Add(olAppointmentItem) On Error GoTo 0 If Not objItem Is Nothing Then ' a new item is created With objItem .Start = Range("A" & r).Value .End = Range("C" & r).Value .Subject = Range("E" & r).Value .Body = Range("F" & r).Value .Categories = Range("G" & r).Value .ReminderSet = True ' reminder .Save ' the new item End With Set objItem = Nothing End If r = r + 1 Loop End With Application.StatusBar = False End Sub However, I would like to amend the code so that the start date for the appointment is entered by the user in any cell in column A starting in A7, the start time is entered in any cell in column B starting in B7, the end date is entered in any cell in column C starting at C7 and the end time is entered in any cell in column D starting in D7. Any ideas? Thanks, Steve |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
excel and outlook calendar | Excel Discussion (Misc queries) | |||
how do i export excel calendar info to outlook calendar? | Excel Discussion (Misc queries) | |||
dates from excel onto outlook calendar | Excel Discussion (Misc queries) | |||
Excel to Outlook Calendar Macro | Excel Discussion (Misc queries) | |||
import calendar items from excel into outlook calendar | Excel Discussion (Misc queries) |