Matrix of AppointmentItem

Im trying to have my script return a list of appointmentitems. Im doing it like this:

Function testing() as AppointmentItem

Dim returnlist(10) as AppointmentItem
Dim item as AppointmentItem

for i = 0 to 9
    item = // create random appointmentitem
    Set returnlist(i) = item
next

testing = returnlist

End Function

The returnlist is filled correctly, however on the line testing = returnlist it gives me Run Time Error '91' : Object Variable or With Block not Set.

What am I missing here?

Answers


You should return array of AppointmentItem's, but not single AppointmentItem. Try this one:

Function testing() as AppointmentItem()
   Dim returnlist(10) as AppointmentItem
   Dim item as AppointmentItem

   For i = 0 to 9
      item = '// create random appointmentitem
      Set returnlist(i) = item
   Next

   testing = returnlist
End Function

Need Your Help

How to deal with Twitter API Limits?

twitter

I have this project that's based on a Twitter Bot. NOT an abusive or spammer bot. Just a robot that will reply with information about my system when it's mentioned.