LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Create Appointment in Outlook

I'm trying to use the following code in Excel to create an appointment
in Outlook. But I keep getting an error with the declaration "Dim
olApt As Outlook.AppointmentItem". It would say: "Compile Error: User-
defined type not defined". If I remove this declaration then an email
message (instead of an appointment) is created ! Please help !


Sub SetAppt()

Dim olApp As Object

On Error Resume Next
Set olApp = GetObject(, "Outlook.Application")

If Err.Number = 429 Then
Set olApp = CreateObject("Outlook.Application")
End If

'Dim olApt As Outlook.AppointmentItem
Set olApt = olApp.CreateItem(olAppointmentItem)

With olApt
.Start = Date + 1 + TimeValue("19:00:00")
.End = .Start + TimeValue("00:30:00")
.Subject = "Piano lesson"
.Location = "The teachers house"
.Body = "Don't forget to take an apple for the teacher"
.BusyStatus = olBusy
.ReminderMinutesBeforeStart = 120
.ReminderSet = True
'.Save
.Display
End With

Set olApt = Nothing
Set olApp = 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
Macro to create outlook appointment Dan Wood Excel Discussion (Misc queries) 2 March 4th 10 01:31 PM
Creating Outlook Appointment NewBike Excel Programming 8 September 25th 06 02:13 PM
Automatically create outlook appointment Alarmbloke Excel Discussion (Misc queries) 0 March 12th 06 08:47 PM
Macro to create a Outlook Appointment from excel cell data Alarmbloke Excel Programming 1 January 27th 06 03:49 PM
Create a button in excel that can open an outlook appointment? Movieman Excel Worksheet Functions 1 July 15th 05 12:20 AM


All times are GMT +1. The time now is 07:23 AM.

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"