Incidentally the Excel version would be as follows - and that too requires a
reference to Outlook.
Sub AddOutlookApptmnt()
Dim ol As New Outlook.Application
Dim ci As AppointmentItem
Dim strDate As String
Dim strDocPath As String
Dim strDocName As String
strDate = DateAdd("m", 1, Date)
strDate = DateAdd("d", 15, strDate)
With ActiveWorkbook
On Error GoTo CancelledByUser
.Save
strDocPath = .FullName
strDocName = .Name
End With
Set ci = ol.CreateItem(olAppointmentItem)
With ci
.Start = strDate
.ReminderSet = True
.AllDayEvent = True
.Subject = strDocName
.Categories = "Excel Documents"
.Body = strDocPath & " requires processing."
.BusyStatus = olFree
.Save
End With
Set ol = Nothing
Exit Sub
CancelledByUser: 'Error handler
MsgBox "Cancelled By User", , "Operation Cancelled"
End Sub
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
My web site
www.gmayor.com
Word MVP web site
http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
"rjagathe" <rjagathe@gmail.com> wrote in message
news:7c2cfe93-1e51-4606-8259-8d6031dedd9e@w27g2000pre.googlegroups.com...
On Feb 21, 6:14 pm, "Graham Mayor" <gma...@REMOVETHISmvps.org> wrote:
> >Hi,
>
> >when I run the maco, the second line throws an error message "user-
>
> >defined type not defined"
> >Please help.
> >-rjagathe
>
> Add a reference to the Microsoft Outlook Object library in the vba
> editor's
> Tools > References
>
> --
> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> Graham Mayor - Word MVP
>
> My web sitewww.gmayor.com
> Word MVP web sitehttp://word.mvps.org
> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Hi,
Even then it throws the same error message.
-rjagathe