Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 343
Default SetFocus question

Can someone tell me why this code does not return the focus to TextBox7

If Len(PhoneNum) = 1 Then 'Checks for a correct amount of numbers
MsgBox "Please enter a correct Phone Number"
TextBox7.SetFocus
End If
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default SetFocus question

What does happen? Where is this code located at? Did you really mean =1?

--
Rick (MVP - Excel)


"Patrick C. Simonds" wrote in message
...
Can someone tell me why this code does not return the focus to TextBox7

If Len(PhoneNum) = 1 Then 'Checks for a correct amount of numbers
MsgBox "Please enter a correct Phone Number"
TextBox7.SetFocus
End If


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,344
Default SetFocus question

Hi,

Your code must be on the userform code sheet. Here is a typical block of
code to handle an incorrect or missing entry:

IF Len(me.txtPhone) <7 then
Beep
MsgBox "That is not a legal phone number."
me.txtPhone=""
me.txtPhone.SetFocut
Exit Sub
End IF

This would be attached to the OK button of your userform in many cases.
--
Thanks,
Shane Devenshire


"Patrick C. Simonds" wrote:

Can someone tell me why this code does not return the focus to TextBox7

If Len(PhoneNum) = 1 Then 'Checks for a correct amount of numbers
MsgBox "Please enter a correct Phone Number"
TextBox7.SetFocus
End If

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
SetFocus? plh Excel Programming 1 May 1st 06 03:01 AM
setfocus Dean Reardon Excel Programming 2 December 15th 04 12:18 PM
SetFocus Question Sam Excel Programming 2 August 20th 04 04:01 PM
UserForm1.Textbox1.SetFocus Question Zane Greer Excel Programming 1 September 14th 03 11:59 AM


All times are GMT +1. The time now is 05:37 PM.

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

About Us

"It's about Microsoft Excel"