Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / October 2006

Tip: Looking for answers? Try searching our database.

check that user selected a value in a list box

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
joncohen - 30 Sep 2006 18:34 GMT
I am trying to validate if a user selected a value in a listbox.  Does anyone
know how to display a message if the listbox has no selected values?

Thanks in advance.

Jonathan
Helmut Weber - 30 Sep 2006 19:13 GMT
Hi,

listindex returns -1
if no item is selected.

Signature

Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"

joncohen - 30 Sep 2006 22:39 GMT
Helmut,

Thank you for your reply,  my issue is that the msgbox displays twice after
verifying that the listbox does not have a selected item.  I must be missing
where to validate the listbox so that i can return the user back to this
listbox.  Any assistance would be appreciated, thank you.

> Hi,
>
> listindex returns -1
> if no item is selected.
Helmut Weber - 01 Oct 2006 08:09 GMT
Hi  Joanthan,

as Jay pointed out, make sure,
that there is always something selected.

I'd add an entry like "---" as item 0,
select always item 0 as the default item
and check afterwards,
if an item other than item 0 was selected.

Signature

Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.