R
Ronald Dodge
Using AC02, SP2, VBA 6.3 on W2K, SP4
What's the deal with such a confusing help file with regards to the
ListIndex Property? On the one hand, it shows in 2 different places (at the
top with "Read/Write" and at the bottom with the example) that the property
can be written to via code, but yet, it also states that the property is
read-only (in the second paragraph under "Remarks" section). Here's the
link to the help file online:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbaac10/htm
l/acprolistindex.asp
When I attempt to set this property, it gives me the error code, "7777",
with the statement, "You've used the ListIndex Property incorrectly." When
I click on the "Help" button, the help file only brings up a blank grey
page.
What I am attempting to do, set which item is the active item as it's shown
via the ListIndex property of a Listbox, as the code shows below, which is
within the MouseMove Event:
Dim CurItem As Long
CurItem = Int((Y - 1) / TPI)
If CurItem < Me.lbxDLU.ListCount And CurItem > -1 Then
Me.lbxDLU.ListIndex = CurItem 'This is the line it errors out on.
Else
Me.lbxDLU.ListIndex = -1
End If
The "TPI" variable is how many twips there are per record including the line
spacing or Twips Per Item.
Here's another link to another example of using the ListIndex property to
select an item within the listbox (or combobox).
http://support.microsoft.com/default.aspx?scid=kb;en-us;209853
The only remote possibility that I could think of, does the control have to
be bound to a table for this property to be written to?
What's the deal with such a confusing help file with regards to the
ListIndex Property? On the one hand, it shows in 2 different places (at the
top with "Read/Write" and at the bottom with the example) that the property
can be written to via code, but yet, it also states that the property is
read-only (in the second paragraph under "Remarks" section). Here's the
link to the help file online:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbaac10/htm
l/acprolistindex.asp
When I attempt to set this property, it gives me the error code, "7777",
with the statement, "You've used the ListIndex Property incorrectly." When
I click on the "Help" button, the help file only brings up a blank grey
page.
What I am attempting to do, set which item is the active item as it's shown
via the ListIndex property of a Listbox, as the code shows below, which is
within the MouseMove Event:
Dim CurItem As Long
CurItem = Int((Y - 1) / TPI)
If CurItem < Me.lbxDLU.ListCount And CurItem > -1 Then
Me.lbxDLU.ListIndex = CurItem 'This is the line it errors out on.
Else
Me.lbxDLU.ListIndex = -1
End If
The "TPI" variable is how many twips there are per record including the line
spacing or Twips Per Item.
Here's another link to another example of using the ListIndex property to
select an item within the listbox (or combobox).
http://support.microsoft.com/default.aspx?scid=kb;en-us;209853
The only remote possibility that I could think of, does the control have to
be bound to a table for this property to be written to?