Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with Outlook Automation from access2000

Status
Not open for further replies.

Devguy

Programmer
Jul 4, 2001
6
NO
I am trying to make my Database automatically update Outlook calendar appointments, but I can' get it right, have been struggeling for weeks now so some help would be very much appreciated, here is the VBA code I have so far:

Dim appOutLook As Outlook.Application
Dim olMAPI As Outlook.NameSpace
Dim Folder As Outlook.MAPIFolder
Dim colItems As Outlook.Items
Dim appointment As Outlook.AppointmentItem



If Me!AddedToOutlook = True Then
MsgBox "This appointment is already added to Microsoft Outlook"
Exit Sub
Else

Set appOutLook = CreateObject("Outlook.Application")
Set olMAPI = GetObject("", "Outlook.Application").GetNamespace("MAPI")
Set Folder = olMAPI.Folders("Trond Strøm").Folders("Kalender")
Set appointment = appOutLook.CreateItem(olAppointmentItem)

With appointment
.Start = Me!ApptDate & " " & Me!ApptTime
.Duration = Me!ApptLength
.Subject = Me!Appt

If Not IsNull(Me!ApptNotes) Then .Body = Me!ApptNotes
If Not IsNull(Me!ApptLocation) Then .Location = Me!ApptLocation
If Me!ApptReminder Then
.ReminderMinutesBeforeStart = Me!ReminderMinutes
.ReminderSet = True
End If


.Save
End With
Set appointment = Nothing
End If

Set objOutlook = Nothing

Me!AddedToOutlook = True
DoCmd.RunCommand acCmdSaveRecord
MsgBox "Appointment Added!"

Set appOutLook = Nothing
Set objNameSpace = Nothing
Set objfolder = Nothing


Help very much appreciated
sincerly
Trond Strom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top