Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

fill array with items

Status
Not open for further replies.

lespaul

Programmer
Feb 4, 2002
7,083
US
I need to get all the items from a document into an array. I have tried the following code with no luck. (Type mismatch error). Any clue what I'm doing wrong? If I just put the Name & text into a messagebox, it shows what I want, but I can't get it into the array! Thanks!

leslie

Forall i In doc.Items
all(i) = (i.Name + ": " + i.Text)
End Forall
 
What is all() in your code?
You are using i as index for the ForAll cicle (where i is a variant of Notesitem) and the next line you're using the same variable as index for an array??
Do you know something I miss?
Try the code below:

Option Base 0
' so you're sure where arrays starts
Sub Toarray(doc As Notesdocument)
Dim docitems As Variant
Dim all() As String
Dim icount As Integer, i As Integer
' Now we collect the items
docitems=doc.Items
' Count items collected
icount=Ubound(docitems)
' At this point we can create the array to receive values
Redim all(count)
' retrievin values from items
i=0
Forall item In docitems
all(i)=item.Name+": "+item.Text
i=i+1
End Forall
' here you got your values in all()
End Sub

Let me know if you found this useful
 
This thread is from May of 2002(!), I don't even remember what I was trying to accomplish, but I'm sure I figured something out!

Thanks


Leslie
landrews@metrocourt.state.nm.us

There are 10 types of people in the world -
those who understand binary
and
those who don't!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top