You need to always post the code that isn't working properly. Otherwise we
can only guess at what might be wrong.
I just tried it and it worked exactly as I expected it to. My simple code
was
Option Explicit
Private Sub TextBox1_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
With TextBox1
Call MsgBox("Rejecting " & .Text)
.SelStart = 0
.SelLength = Len(.Text)
End With
Cancel.Value = True
End Sub
Regards, Dave S
----- Original Message -----
From: "noskosteve" <noskosteve@yahoo.com>
To: <ExcelVBA@yahoogroups.com>
Sent: Monday, October 29, 2012 4:02 PM
Subject: [ExcelVBA] Re: XL2007 Unable to select Form TextBox with code
>
>
>> One I like is the EnterFieldBehavior property, ...
>
> This is set already to SelectAll. Tabbing into the TextBox has the entire
> contents selected as I want, but not so with the Cancel.Value thingy.
>
>
>> There also seem to be SelStart and SelLength properties...
> I have been unable to get these to do what I Help seems to be saying.
> SelStart = 0 (set cursor to beginning) and SelLength = 3 (select 3
> characters) aren't doing what the help is saying, but instead, the next
> Form Control in the Tab order gets selected instead of the current
> TextBox...Arrrrg!
>
> Something else perhaps like some condition must not be correct. Some
> fiddling is in order.
>
> Thanks, Steve N.
>
>
>
> ------------------------------------
>
> ----------------------------------
> Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go
> here: http://www.mousetrax.com/techtrax to enter the ezine, then search
> the ARCHIVES for EXCEL VBA.
>
> ----------------------------------
> Visit our ExcelVBA group home page for more info and support files:
> http://groups.yahoo.com/group/ExcelVBA
>
> ----------------------------------
> More free tutorials and resources available at:
> http://www.mousetrax.com
>
> ----------------------------------Yahoo! Groups Links
>
>
>
>
>
> -----
> No virus found in this message.
> Checked by AVG - www.avg.com
> Version: 10.0.1427 / Virus Database: 2441/5359 - Release Date: 10/28/12
>
Reply via web post | Reply to sender | Reply to group | Start a New Topic | Messages in this topic (6) |
Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go here: http://www.mousetrax.com/techtrax to enter the ezine, then search the ARCHIVES for EXCEL VBA.
----------------------------------
Visit our ExcelVBA group home page for more info and support files:
http://groups.yahoo.com/group/ExcelVBA
----------------------------------
More free tutorials and resources available at:
http://www.mousetrax.com
----------------------------------
Tidak ada komentar:
Posting Komentar