LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default SetFocus method

I am creating a user form and am trying to include in the code behind the
form functionality that will ensure that the user has filled in all of the
required information. So I have a long "Validate Self" procedure that
depends on a series of message boxes to tell the user that various bits of
information have not been provided. Here's an example:

Else
If txtUserEmail.Value = "" Then 'if the user has not
entered a name in the text box
Dim Answer As VbMsgBoxResult
Answer = MsgBox("You have not entered your e-mail
address.", vbOKCancel)
If Answer = 2 Then
Exit Function
Else
Exit Function
txtUserEmail.SetFocus
End If
End If
End If

What happens is that the message box doesn't disappear on the first click of
any of the buttons or the "x" at the top right of the box. It takes several
clicks for the message box to decide it's okay to disappear. And then, when
it does disappear, it's not at all clear that the txtUserEmail text box is
what has the focus.

Any suggestions as to what I am doing wrong would be greatly appreciated!
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
SetFocus? plh Excel Programming 1 May 1st 06 03:01 AM
SetFocus on a different sheet in VBA AaronC Excel Discussion (Misc queries) 1 June 9th 05 11:18 PM
setfocus Dean Reardon Excel Programming 2 December 15th 04 12:18 PM
SetFocus Question Sam Excel Programming 2 August 20th 04 04:01 PM
SetFocus method in VBA Robin S. Excel Programming 2 July 16th 03 10:20 PM


All times are GMT +1. The time now is 04:19 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"