Results 1 to 5 of 5
  1. #1
    Platinum Lounger
    Join Date
    Nov 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    5,016
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Userform - Setting Focus (revisited) (VBA/Office/2000)

    I searched for and found some discussion on this problem in this thread. Jefferson's clever use of a Tab followed by a Shift+Tab, via SendKeys, does the trick for me. I'm wondering though, whether the bug was fixed in SP1, in which case I'll install it. Also whether a user of my form, without SP1, will still experience this annoying behaviour even though SP1 has "fixed" it at my end.

    Just out of interest too, Ann Brandon points to a MSKB article describing the "problem" and offering a workaround that doesn't. Then Howard says it's NOT a bug and seems to be suggesting another workaround that I can't follow. So is there a workaround, apart from Jefferson's, that does work without patching Office?

    thanks

    Alan

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Userform - Setting Focus (revisited) (VBA/Office/2000)

    Actually, I think the MSKB article (XL2000: SetFocus Property on TextBox Does Not Work as Expected) only gets you to the next step of having the problem discussed in that thread. But if you are using Outlook 2000, of course you should install SR-1. Why wouldn't you?? For what it's worth, the insertion point does appear as expected in a Word 2002 UserForm.

    To get back to the problem at hand, my <!post=old post,66902>old post<!/post> suggests that the control does get the focus but the insertion point is not visible. We need to find a trick to make the insertion point visible. I guess this leaves you where you started, but maybe you could find a new trick not previously uncovered and make everyone happy.

  3. #3
    Platinum Lounger
    Join Date
    Nov 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    5,016
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Userform - Setting Focus (revisited) (VBA/Office/2000)

    Hi Jefferson

    I don't use Outlook, but I still intend installing all of the Office SPs/SRs when I reinstall on the new box. BTW, why is Outlook of particular significance to SR1?

    I noticed the same as you - that the "bug" is not that the control doesn't have focus; rather that the cursor is not visible. I like your workaround because it doesn't depend on whether the cursor is showing or not, so it will work regardless. I certainly haven't been able to come up with any other solution.

    The reason I "revisited" this topic is because it appeared (to me) that the "bug" issue remained unresolved in the thread I cited. I was hoping that maybe somebody had discovered something else in the interim. I still can't understand <!post=Howard's comment,67730>Howard's comment<!/post> that "THat's not a bug. That's incorrect coding." This suggested (to me) that the whole problem was based in the way people were coding. Still in the dark...

    Alan

  4. #4
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Userform - Setting Focus (revisited) (VBA/Office/2000)

    <P ID="edit" class=small>(Edited by jscher2000 on 25-Jan-04 12:26. Oops, missed a question...)</P>To address the question about Outlook, in SP2 for Office 2000, and various other upgrades and patches, Microsoft added the Outlook object model guard which pops up messages when other applications attempt to access addresses or send messages. I guess over the past 3 years most people have come to accept that this annoyance is acceptable in exchange for the fixes to the various applications. But if you don't use Outlook, you won't even have to deal with the annoyances.

    For further commentary on the object model guard, search for "draconian" in relation to Outlook, and many threads will appear.

    Regarding Howard's comment, if you look closely at the example on the MSKB, the programmer was attempting to set focus on a control before showing the form. This is just not possible. (Maybe someone will say it should be possible if you first Load the form, but because the bug will kick in either way, I guess it's academic for purposes of this thread.)

  5. #5
    Platinum Lounger
    Join Date
    Nov 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    5,016
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Userform - Setting Focus (revisited) (VBA/Office/2000)

    OK, I think that explains it all thanks. And, as you say, the bug seems to kick in regardless, so it's a bit academic. But not satisfied, I tried to fiddle with this and discovered that the presence of a Frame control seems to be the key to this unwanted behaviour.

    I started with a form with a textbox, a command button and an empty frame and ran the form.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •