Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default UserForm Setfocus Problem

I have several textboxes to collect bank account details. I'm running the
following code on exit:

Private Sub txtBankNum1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If Len(txtBankNum1) < 2 Then
MsgBox "Please enter the two digit bank code."
txtBankNum1.SetFocus
End If
End Sub

Problem is that this doesn't reset the cursor to txtBankNum1, it just moves
on to the next box as normal. Any ideas?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 371
Default UserForm Setfocus Problem

Have you tried
Private Sub txtBankNum1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If Len(txtBankNum1) < 2 Then
MsgBox "Please enter the two digit bank code."
Cancel = True
End If
End Sub

hth

Geoff
"BOBODD" wrote:

I have several textboxes to collect bank account details. I'm running the
following code on exit:

Private Sub txtBankNum1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If Len(txtBankNum1) < 2 Then
MsgBox "Please enter the two digit bank code."
txtBankNum1.SetFocus
End If
End Sub

Problem is that this doesn't reset the cursor to txtBankNum1, it just moves
on to the next box as normal. Any ideas?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default UserForm Setfocus Problem

Cheers, perfect.

"Geoff" wrote:

Have you tried
Private Sub txtBankNum1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If Len(txtBankNum1) < 2 Then
MsgBox "Please enter the two digit bank code."
Cancel = True
End If
End Sub

hth

Geoff
"BOBODD" wrote:

I have several textboxes to collect bank account details. I'm running the
following code on exit:

Private Sub txtBankNum1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If Len(txtBankNum1) < 2 Then
MsgBox "Please enter the two digit bank code."
txtBankNum1.SetFocus
End If
End Sub

Problem is that this doesn't reset the cursor to txtBankNum1, it just moves
on to the next box as normal. Any ideas?

Reply
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
userform setfocus question Gary Keramidas Excel Programming 3 November 27th 06 09:20 PM
Userform SetFocus with Exit and Cancel Neal Excel Programming 3 January 31st 06 01:21 AM
Userform setfocus problem Martin Hibberd[_2_] Excel Programming 1 November 10th 04 12:12 PM
SetFocus to first textbox on userform upon Userform1.Show Paul Simon[_3_] Excel Programming 6 February 11th 04 04:31 PM
SetFocus problem RFraley Excel Programming 2 September 7th 03 01:18 PM


All times are GMT +1. The time now is 10:42 AM.

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"