Group:  Microsoft Word ยป microsoft.public.word.vba.userforms
Thread: Loading a forum without a focus

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

Loading a forum without a focus
drink_sangiovese[ at ]yahoo.com 26.01.2006 20:33:41
I have a user form in my application (VBA under ArcGIS) that has 20 or
so checkboxes. The code for my form determines if the various check
boxes will be enabled or not when the form loads, based on a value I
acquired before loading the form. It's all working fine, although when
I load it the first enabled checkbox gets the focus and has that thin
dashed line around it. I would rather not have the focus on any check
box, or on any other object on my form, when I load the form. How do I
do this? How do I load a focus-free form?

Re: Loading a forum without a focus
"Karl E. Peterson" <karl[ at ]mvps.org> 26.01.2006 21:56:46
drink_sangiovese[ at ]yahoo.com wrote:
[Quoted Text]
> I have a user form in my application (VBA under ArcGIS) that has 20 or
> so checkboxes. The code for my form determines if the various check
> boxes will be enabled or not when the form loads, based on a value I
> acquired before loading the form. It's all working fine, although when
> I load it the first enabled checkbox gets the focus and has that thin
> dashed line around it. I would rather not have the focus on any check
> box, or on any other object on my form, when I load the form. How do I
> do this? How do I load a focus-free form?

Here's a quick and dirty way. Put an empty Frame control on the UserForm,
then add code like this to move it out sight:

Private Sub UserForm_Initialize()
Frame1.Move -2 * Frame1.Width
Frame1.SetFocus
End Sub

And this, to transfer focus (appropriately) if the user tabs to it:

Private Sub Frame1_Enter()
If Me.Visible Then CheckBox1.SetFocus
End Sub

Later... Karl
--
Working without a .NET?
http://classicvb.org/


Re: Loading a forum without a focus
"DS" <drink_sangiovese[ at ]yahoo.com> 27.01.2006 00:43:04
That worked beautifully. Thanks!

Re: Loading a forum without a focus
"Karl E. Peterson" <karl[ at ]mvps.org> 27.01.2006 01:50:07
DS wrote:
[Quoted Text]
> That worked beautifully. Thanks!

Cool. :-)
--
Working without a .NET?
http://classicvb.org/


Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net