emailing outlook appointment via code (1 Viewer)

Matty

...the Myth Buster
Local time
Today, 03:23
Joined
Jun 29, 2001
Messages
396
Hi,

I know there are ways to send email messages with attachments thru code (via outlook automation), but all the posts that i've found only show you how to add files as attachments. Is there any way to send actual outlook items such as appointments the same way? I'm basically trying to do the same thing as going Insert, Item in a new email message in Outlook 2000.

i'm asking this because our shared calendar setup has kinda gone screwy. I'm trying to find a way to send an appointment to someone else's calendar when I enter appointment dates on a form on MY computer.

if anyone has any ideas, either on how to fix my code problem or some other way to make an appointment on a different computer, i'd be happy to hear it.
 

jfgambit

Kinetic Card Dealer
Local time
Today, 09:23
Joined
Jul 18, 2002
Messages
798
Function CreateAppointment() As Boolean
' This procedure creates a new AppointmentItem object and
' displays the new AppointmentItem object in Outlook
' for further input by the user.

Dim objNewAppt As AppointmentItem

On Error GoTo CreateAppointment_Err

' Use the InitializeOutlook procedure to initialize global
' Application and NameSpace object variables, if necessary.
If golApp Is Nothing Then
If InitializeOutlook = False Then
MsgBox "Unable to initialize Outlook Application " _
& "or NameSpace object variables!"
Exit Function
End If
End If

Set objNewAppt = golApp.CreateItem(olAppointmentItem)
With objNewAppt
.Recipients.Add Forms!Customers!ContactName
.Subject = "Meet with " & Forms!Customers!ContactName _
& " from " & Forms!Customers!CompanyName
.Categories = "Business; Key Customer"
.Display
End With

CreateAppointment = True

CreateAppointment_End:
Exit Function
CreateAppointment_Err:
CreateAppointment = False
Resume CreateAppointment_End
End Function
 

Matty

...the Myth Buster
Local time
Today, 03:23
Joined
Jun 29, 2001
Messages
396
thanx for the function, I had most of the appointment creation up and working like that.

What does the recipients.add line do? Does this appointment actually get sent to the person in Forms!Customers!ContactName? or does it just say that's who my appointment is with?

If i was to run this function on my computer, is the appointment only gonna be set in my calendar, or will it go in the recipient's calendar as well?

Making a basic, local appointment is not a problem for me. The problems come when i try to put that appointment on other calendars.
 

jfgambit

Kinetic Card Dealer
Local time
Today, 09:23
Joined
Jul 18, 2002
Messages
798
If you are only concerned in making an appointment for yourself then you don't need the recp lines. many individuals make appointments not only for themselves, but for others as well. The recp.add lines are for those individuals that you want to invite to the appointment. If you have a textbox ot listbox containing the names of the individuals (exactly as they appear on your server) then you can add these people to yur appointment.

Hope that clarifies things.
 

Matty

...the Myth Buster
Local time
Today, 03:23
Joined
Jun 29, 2001
Messages
396
thanx for the info. i'll see if i can get it to work.
 

Users who are viewing this thread

Top Bottom