Marking events in Word Calendar

V

vrk1

Hi,

I have a text file that has information as follows:

Start Date End Date Event name
1/1/2007 1/5/2007 Inauguration ceremony
2/5/2007 2/9/2007 Camping
2/15/2007 2/16/2007 All employee meeting
........

I want to create a program in Word that would read this text file and mark
these events in a Word Calendar for the year (created using the standard
Calendar template). For instance, there should be a bar marked from 1/1/2007
to 1/5/2007 in yellow color with the Event name. I need to do this for all
the rows in the Text file.

I am sure someone would have done this before. Can someone give me an idea
of how to achieve a solution programatically please?
 
A

alborg

You can probably do that with the calendar control and vba, but it's more
work than it's worth. I tried it once, and after several days just gave up.

The best route to achieve what you are trying to do is to Google "ActiveX
Calendar control". One such control costs only $60 per developer and can be
found here:

http://www.viscomsoft.com/products/calendar/

Cheers,
Al
 
G

Graham Mayor

Another possibility is to use Outlook to store your data. Convert your data
list to a three column table
(http://www.gmayor.com/convert_labels_into_mail_merge.htm ) then run the
following macro to import that data table into Outlook's calendar
http://www.gmayor.com/installing_macro.htm You can then print a calendar
from Outlook.

Sub AddApptmnt()
Dim ol As New Outlook.Application
Dim ci As AppointmentItem
Dim ctable As Table
Dim i As Long
Dim strStartDate As Range
Dim strEndDate As Range
Dim strSubject As Range

Set ctable = ActiveDocument.Tables(1)
For i = 2 To ctable.Rows.Count
Set strStartDate = ctable.Cell(i, 1).Range
strStartDate.End = strStartDate.End - 1
Set strEndDate = ctable.Cell(i, 2).Range
strEndDate.End = strEndDate.End - 1
Set strSubject = ctable.Cell(i, 3).Range
strSubject.End = strSubject.End - 1
Set ci = ol.CreateItem(olAppointmentItem)
ci.Start = strStartDate
ci.End = strEndDate
ci.ReminderSet = False
ci.AllDayEvent = True
ci.Subject = strSubject
ci.Categories = "Events"
ci.BusyStatus = olFree
ci.Save
Set ol = Nothing
Next i
End Sub


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top