Group:  Microsoft Word ยป microsoft.public.word.vba.general
Thread: Opening User Form with items selected in List Box

Geek News

Opening User Form with items selected in List Box
Stephen English 12/30/2008 5:43:01 AM
When I open a User Form with a listbox in fmMultiSelectMulti mode, I want to
be able to select several values based on the list index number
i.e I know i want the first, third and fifth values selected
Anyone know how I do this please?
I have tried frmReport.lstDirections(3).Selected = True

Thanks
Stephen
Re: Opening User Form with items selected in List Box
"Greg Maxey" <gmaxey[ at ]mIKEvICTORpAPAsIERRA.oSCARrOMEOgOLF> 12/30/2008 1:27:52 PM
The following opens a UserForm with A, E, and Z selected in a mulitselect
listbox:

Private Sub UserForm_Initialize()
Dim myArray() As String
myArray = Split("A B C D E F G H I J K L M N O P Q R S T U V W X Y Z", " ")
Me.ListBox1.List = myArray
Me.ListBox1.MultiSelect = fmMultiSelectMulti
With Me.ListBox1
.Selected(0) = True
.Selected(4) = True
.Selected(25) = True
End With
End Sub


--
Greg Maxey - Word MVP

My web site http://gregmaxey.mvps.org
Word MVP web site http://word.mvps.org


"Stephen English" <StephenEnglish[ at ]discussions.microsoft.com> wrote in
message news:3CF7FE0C-E78E-46DE-A827-8C5C417B56E4[ at ]microsoft.com...
[Quoted Text]
> When I open a User Form with a listbox in fmMultiSelectMulti mode, I want
> to
> be able to select several values based on the list index number
> i.e I know i want the first, third and fifth values selected
> Anyone know how I do this please?
> I have tried frmReport.lstDirections(3).Selected = True
>
> Thanks
> Stephen


Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net