View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
keepITcool keepITcool is offline
external usenet poster
 
Posts: 2,253
Default linking Outlook appointments and contacts from Excel

Savarin,

Check your use of "." when using With constructs.
e.g. to set the item's Start Property

Wrong:

With olAppItem
start = now
End with

Correct:
With olAppItem
.Start = now
End with



keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


savarin wrote:

I am using VBA to create Outlook appointments and contacts. I can't

seem
to figure out how to link the appointment to the contact. Please help


This is the code I am using:

Sub Register_Appointment()
Dim olApp As Outlook.Application
Dim olAppItem As Outlook.AppointmentItem
Dim itmContact As Outlook.ContactItem
Dim myNameSpace As Outlook.NameSpace
Dim myFolder As Outlook.MAPIFolder
Dim tempstr As Outlook.ContactItem
Dim myItems As Outlook.Folders

Set olAppItem = olApp.CreateItem(olAppointmentItem)

' creates a new appointment

Set itmContact = olApp.CreateItem(olContactItem)
Set myNameSpace = olApp.GetNamespace("MAPI")
Set myFolder = myNameSpace.GetDefaultFolder(olFolderContacts)

With olAppItem
Start = Now
End = Now
Subject = "No subject"
Location = ""