Link to home
Start Free TrialLog in
Avatar of PrashanthKiran
PrashanthKiran

asked on

Can I refer two appointmentItem refer to the same outlook calendar folder

HI,

Can I refer two appointmentItem refer to the same outlook calendar folder

I have code something like this

"general declaration "

Public objOutlook As Outlook.Application
Dim mNameSpace As Outlook.NameSpace

"In form load "

Set objOutlook = CreateObject("Outlook.Application")
Set mNameSpace = objOutlook.GetNamespace("Mapi")

"In sub MySub"

Dim AppItem As Outlook.AppointmentItem
Dim  FilterAppItem  As Outlook.AppointmentItem

 Set AppItem = mNameSpace.GetDefaultFolder(olFolderCalendar).Items()
         Set FilterAppItem = mNameSpace.GetDefaultFolder(olFolderCalendar).Items()


In MySub first line excutes perfectly W/O any problem , but in the second line of code ie

Set FilterAppItem = mNameSpace.GetDefaultFolder(olFolderCalendar).Items()

It throws an error "Run time Error 13   Type mismatch"

Can any one tells the reason for this.

If this is not correct, How to iterate in the AppointmentItems

TIA

Prashanth Kiran G

ASKER CERTIFIED SOLUTION
Avatar of jessnjeff
jessnjeff

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jessnjeff
jessnjeff

Dim mItem As outlook.AppointmentItem
Dim mFItem As outlook.AppointmentItem



For Each mItem In AppItem
do my stuff