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 / September 2005

Tip: Looking for answers? Try searching our database.

Capturing ENTER keypress in a listbox

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Amir - 11 Sep 2005 00:45 GMT
Hi,

I have a listbox name lstOptions in a form named UserForm1, which I use in
Word.

I wish that when the user presses the Enter Key in that form, it will run a
procedure named "CompleteByListSelection".

I've succeded in doing the same for the DoubleClick mouse event by using the
following code:

'Code:
Private Sub lstOptions_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
   CompleteByListSelection
End Sub

How can I do the same for the Enter key press event?

I know VBA and a bit of VB.
I use Office 2000. Using API calls is also 'allowed' even though I'm not an
expert in that.

Kind Regards,
Amir.
Amir - 11 Sep 2005 01:17 GMT
Solved:

Private Sub lstOptions_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
   If KeyAscii = vbKeyReturn Then
       CompleteByListSelection
   End If
End Sub

Regards.

> Hi,
>
[quoted text clipped - 20 lines]
> Kind Regards,
> Amir.
 
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.