I am in the process of creating what to me is a complex VBA project for Word 2000 because of the need for the functionality and most of all the desire to learn. When I get stumped I am coming to you guys.
All I am trying to do is cause a list box to sort its contents (single column) alphabetically. It is amazing to me that this is so easy in VB (just a property), but seems to require a lot in VBA (But I guess they are both done by Microsoft ). I have seen some suggestions for situations similar to my own which require the use of an array. I have tried to work with this, but I think my lack of understand of some of the syntax is preventing me from getting this to work.
If someone could help me with that, or if they know of a better way, I would sure appreciate the help!! If you can please provide good comments so I will understand how this is working.
If you suggest arrays, I want to understand:
-what kind of array I should use (integer, variant, etc.).
-how to add a dynamic number of items to the array (I assume I would add all of the contents of the list box to the array whether they be 2 or 20).
-how to sort them once I get them there (“WordBasic.SortArray myArray()” caused in invalid procedure or argument error).
-then how to take the sorted values and put them back in the list box (I am assuming that I will clear the list box before putting the sorted values back in).
I know I’m asking a lot, or at least it seems like a lot to me, but it will really help my understanding of VBA to get a little bit of handle on arrays/sorting.
Thanks!!
Troy