Determining Item Methods Available

L

lorenmcguire

I have thousands of records in an Calendar. These records have been input by
numberous people in a variety of ways using ANY TYPE of Form, including their
own. Is there a way I can pick out the available methods on a Form for a
particular item in that for. As an Example, everyone has a date in the form,
because it is a Calendar entry. However, the item may not support an
item.Start method to get the start date, or an item.Stop method to get the
stop date. How can I figure out what methods are available for the items in
the calendar?

As an example, the following code works on the first item, but fails with an
error stating "Item doesn't support this property or method:itm.Start" on the
second record. It also fails on the third record if I skip the 2nd record.

'Iterate through items in Calendar folder, and export a few fields
'from each item to a row in the Calendar worksheet
For Each itm in itms
i = i + 1

MsgBox "i = " & i
MsgBox "itm = " & itm

If itm <> "JPM" Then
'MsgBox "itm.End = " & itm.End
'MsgBox "itm.Start = " & itm.Start


lngASCII = lngASCII + 1
strASCII = Chr(lngASCII)
strRange = strASCII & CStr(i)
Set objRange = objExcelSheet.Range(strRange)
If itm.Start <> "" Then objRange.Value = itm.Start

If Err.Number <> 0 Then
MsgBox "Well, That didn't Work"
strMessage = "The following error " & Err.Description & _
" has occurred in the " & Err.Source & " appliction. " & _
"The error number was " & Err.Number & ". " & _
"Please report this error to the help desk."

MsgBox strMessage,16,"Run-time Error #" & Err.Number

End If


MsgBox "objRange.Value = " & objRange.Value

lngASCII = lngASCII + 1
strASCII = Chr(lngASCII)
strRange = strASCII & CStr(i)
Set objRange = objExcelSheet.Range(strRange)
'If itm.End <> "" Then objRange.Value = itm.End

lngASCII = lngASCII + 1
strASCII = Chr(lngASCII)
strRange = strASCII & CStr(i)
Set objRange = objExcelSheet.Range(strRange)
'If itm.CreationTime <> "" Then objRange.Value = itm.CreationTime

lngASCII = lngASCII + 1
strASCII = Chr(lngASCII)
strRange = strASCII & CStr(i)
Set objRange = objExcelSheet.Range(strRange)
If itm.Subject <> "" Then objRange.Value = itm.Subject

lngASCII = lngASCII + 1
strASCII = Chr(lngASCII)
strRange = strASCII & CStr(i)
Set objRange = objExcelSheet.Range(strRange)
If itm.Location <> "" Then objRange.Value = itm.Location

lngASCII = lngASCII + 1
strASCII = Chr(lngASCII)
strRange = strASCII & CStr(i)
Set objRange = objExcelSheet.Range(strRange)
'If itm.Categories <> "" Then objRange.Value = itm.Categories

lngASCII = lngASCII + 1
strASCII = Chr(lngASCII)
strRange = strASCII & CStr(i)
Set objRange = objExcelSheet.Range(strRange)
'If itm.IsRecurring <> "" Then objRange.Value = itm.IsRecurring

lngASCII = 64
Else
MsgBox "This was the J Record"
End If

Next

End Sub


!Help is appreciated.... this is code that I took from code58.zip
download.... Works fine on my local calendar, but the exchange calendar has
over 3000 records to go through..... Am I missing something here?

Thanks
 
S

Sue Mosher [MVP-Outlook]

You need to check the Class property to determine what type of item you're working with. Once you know what, the object browser will tell you want methods are available: Press ALt+F11 to open the VBA environment in Outlook, then press F2. Switch from <All Libraries> to Outlook to browse all Outlook objects and their properties, methods, and events. Select any object or member, then press F1 to see its Help topic.


--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top