LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Junior Member
 
Posts: 9
Default

Quote:
Originally Posted by Schedule Guy View Post
I have a list of events in an Excel table with related dates in the adjacent
column. I want to automatically populate a calendar so the information is
displayed similar to filling in the blocks of a wall calendar. Is there an
easy way of doing this?
Schedule Guy
Its difficult to know without more info but I guess some form of lookup could work. Alternatively and possibly a better solution would be to use VBA to import your list to the Microsoft Outlook calendar. Not much outlook code exists out there but I have some untested code that imports data from excel to outlooks calendar. Not having tried it yet I can't tell you if it works properly! but would be one solution

here it is and is based on your data starting in row 2 ("iRow") with column 1 as 'subject' column 2 as 'name' 3 as 'categories' and so on as you follow the code through

Sub ImportAppointments()
Dim exlApp As Excel.Application
Dim exlWkb As Workbook
Dim exlSht As Worksheet
Dim rng As Range

Dim itmAppt As Outlook.AppointmentItem
Dim aptPtrn As Outlook.RecurrencePattern



Dim fso As FileSystemObject
Dim fl As File

Set exlApp = New Excel.Application

strFilepath = exlApp.GetOpenFilename
If strFilepath = False Then
exlApp.Quit
Set exlApp = Nothing
Exit Sub
End If




Set exlSht = Excel.Application.Workbooks.Open(strFilepath).Work sheets(1)
Dim iRow As Integer
Dim iCol As Integer

Dim tmpItm As Outlook.Link
Dim mpiFolder As MAPIFolder
Dim oNS As NameSpace

Set oNS = Outlook.GetNamespace("MAPI")

Set mpiFolder = oNS.GetDefaultFolder(olFolderContacts)

iRow = 2
iCol = 1

While exlSht.Cells(iRow, 1) < ""
Dim cnct As ContactItem
Set itmAppt = Outlook.CreateItem(olAppointmentItem)
itmAppt.Subject = exlSht.Cells(iRow, 1)
Set cnct = mpiFolder.Items.Find("[FullName] = " & exlSht.Cells(iRow, 2))
If cnct Is Nothing Then
Set cnct = Outlook.CreateItem(olContactItem)
cnct.FullName = exlSht.Cells(iRow, 2)
cnct.Save
End If
itmAppt.Categories = exlSht.Cells(iRow, 3)
itmAppt.Start = exlSht.Cells(iRow, 4)
itmAppt.AllDayEvent = True

itmAppt.Links.Add cnct
Set aptPtrn = itmAppt.GetRecurrencePattern
aptPtrn.StartTime = exlSht.Cells(iRow, 5)
aptPtrn.EndTime = exlSht.Cells(iRow, 6)
aptPtrn.RecurrenceType = olRecursYearly
aptPtrn.NoEndDate = True
If aptPtrn.Duration 1440 Then aptPtrn.Duration = aptPtrn.Duration - 1440
Select Case exlSht.Cells(iRow, 7)
Case "No Reminder"
itmAppt.ReminderSet = False
Case "0 minutes"
itmAppt.ReminderSet = True
itmAppt.ReminderMinutesBeforeStart = 0
Case "1 day"
itmAppt.ReminderSet = True
itmAppt.ReminderMinutesBeforeStart = 1440
Case "2 days"
itmAppt.ReminderSet = True
itmAppt.ReminderMinutesBeforeStart = 2880
Case "1 week"
itmAppt.ReminderSet = True
itmAppt.ReminderMinutesBeforeStart = 10080
End Select
itmAppt.Save
iRow = iRow + 1
Wend
Excel.Application.Workbooks.Close
exlApp.Quit
Set exlApp = Nothing


End Sub
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert list of events to calendar format LisaZ Excel Discussion (Misc queries) 1 September 12th 08 10:57 AM
create calendar with only M-F and add multiple repeating events johnp Excel Discussion (Misc queries) 1 March 23rd 08 08:54 PM
monthly cycle events to add to calendar object jforbes Excel Discussion (Misc queries) 7 October 8th 07 08:35 PM
Calendar that automatically push events back one day. data3501 Excel Discussion (Misc queries) 1 February 3rd 05 01:00 AM
Ploting dates against a calendar and not as a simple events Barb Reinhardt Charts and Charting in Excel 2 January 22nd 05 02:41 AM


All times are GMT +1. The time now is 03:20 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"