Using Outlook 2003 VBA UserForm List Box "Text" property

G

Guest

I am running Outlook 2003 Pro with all the lastest updates and bug fixes. I
am having a problem using a VBA UserForm List Box control's "Text" property.

I have set up the List Box similar to the way it appears in Outllook's
default Reminders form pop up with 3 columns indicating "Reminder#", "Subject
(Caption)", and "Due". The "Reminder #" column is simple numbers from 1 to
the Reminders.Count.

I have no problem displaying the List Box with the multiple columns and
moving up and down through the list with arrow keys or the mouse.

According to the help reference, setting the value of the ListBox Text
property programicatlly will cause the List Box to move to the first matching
item in the list.

When I attempt to set that Text property value, I get an error message
saying "Could not set the Text Property. Invalid Property Value".

ReminderList is the name of the ListBox. RemIndex is the var containing the
values displayed in the first column. I am sending it a Text Value as follows:
ReminderList.Text = Format(RemIndex, "###0")
I have even tried something more simple such as:
ReminderList.Text = "1"
ReminderList.Text = 1
Everything I have tried results in the same error message. I have even
attempted to send the values with SendKeys but that doesn't get it done
either.

I have set the ReminderList List Box as the first item in the Tab Order
list. The TabIndex property confirms it is a "0".

And I have an additional related problem, when the List Box is first
displayed, the first item in the list is not hilited (selected) unless I hit
an arrow key or click it with the mouse.

In addition to the List Box, I also have text boxes on the form which
display additional information from the List Box data background array that
depends on the List Box value. I have no problem updating those text boxes as
I move up and down through the List Box.

But my problem comes in that the data is not displayed in those text boxes
when the form is initialized because there is no item selected until I
manually select it with the arrow keys or mouse. But I can tell for certain
that the List Box does have the focus because when it is first displayed, if
my fist keystroke is a down arrow, the second item in the List Box becomes
hilited.

I want that data displayed for the first item in the list immediately when
the form is first displayed. To do that I need to be able get the first item
in the list hilited (selected) during initilization. So that is why all of
this entire problem has come up.

Any help or ideas tremendously appreciated!!

Bill Molony
 
G

Guest

Ooooops!!!!

After HOURS of work, I finally figured it out. As usual, something just too
simple to notice.

My List Box array 1st dimension was filled with numerics. When I changed it
to be filled with String versions of the numbers, the .Text property worked
perfectly.

Sorry if I wasted someone's time! :)

Bill
 

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