Accessing user defined variables?

  • Thread starter Thread starter Linn Kubler
  • Start date Start date
L

Linn Kubler

Now I'm trying to access the contents of user defined variables and I'm
getting error messages. In this case I have a variable I defined on a
public folder calendar called Team. The following code works down to the
PatientRecord.UserProperties.Find command at which point I get the error:
Type missmatch.

Dim orgDeliveriesFolder As Outlook.Folders
Dim PatientRecord As Outlook.AppointmentItem
Dim PatientList As Outlook.Items
Dim objProperty As Outlook.UserProperties

Set PatientList = orgDeliveriesFolder.Items()
Set PatientRecord = PatientList.GetFirst

MsgBox ("Deliveries Folder Name = " & orgDeliveriesFolder.Name _
& Chr(13) & "No. of Patients = " &
orgDeliveriesFolder.Items().Count)

For i = 1 To 5

MsgBox ("Patient Name = " & PatientRecord.Subject & Chr(13) & _
"Location = " & PatientRecord.Location & Chr(13) & _
"Start = " & PatientRecord.Start & Chr(13) & _
"Categories = " & PatientRecord.Categories & Chr(13) & _
"Message = " & PatientRecord.Body)

Set objProperty = PatientRecord.UserProperties.Find("Team")
If TypeName(objProperty) <> "Nothing" Then
MsgBox "Got it!"
End If

Set PatientRecord = PatientList.GetNext
Next i

So the line, "Set objProperty = PatientRecord.UserProperties.Find("Team")"
throws the error. I don't get it, it's almost identical to the example in
the online help. And, it works on another, unrelated public calendar. With
the exception that the UDF doesn't exist on that calendar.

Once again, any help is greatly appreciated,
Linn
 
Look at your declaration statement:

Dim objProperty As Outlook.UserProperties

Your problem statement returns a single UserProperty, not a UserProperties collection.
--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
Yep, that's it alright. It's amazing how obvious the solution seems once
you see it... lol Thanks once again for the help.
Linn

Look at your declaration statement:

Dim objProperty As Outlook.UserProperties

Your problem statement returns a single UserProperty, not a UserProperties
collection.
--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
Back
Top