Results 1 to 6 of 6
  1. #1
    Bronze Lounger
    Join Date
    Jun 2001
    Location
    New York, New York, Lebanon
    Posts
    1,449
    Thanks
    1
    Thanked 1 Time in 1 Post

    Userform in Excel 2000 (2000 (9.0.2720))

    Gang

    I have the following code snipit that does not work in MS-Excel 2000, and I am not sure why?!

    Private Sub UserForm_Initialize()
    With Me
    With .tbUserID
    .Visible = True
    .Enabled = True
    .Text = ""
    .SetFocus
    End With
    tbUserID is a textbox on the UserForm called tbUserID. But it does not get the focus. I tried using the workbook with XL 97 and it works as advertised... OK any solutions?

    TIA

    Wassim
    <img src=/S/compute.gif border=0 alt=compute width=40 height=20> in the <img src=/S/bagged.gif border=0 alt=bagged width=22 height=22>

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Dublin, Ireland, Republic of
    Posts
    2,697
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Userform in Excel 2000 (2000 (9.0.2720))

    Try reading through <A target="_blank" HREF=http://www.wopr.com/cgi-bin/w3t/showflat.pl?Cat=&Board=xl&Number=76171&page=0&view =expanded&sb=5&o=0&fpart=>This Thread</A>, and you might get a solution. If not let us know.

    As a matter of interest are you using frames in the userform ?

    Andrew C

  3. #3
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Userform in Excel 2000 (2000 (9.0.2720))

    This is the second post on this problem here in a couple of days. I found <A target="_blank" HREF=http://support.microsoft.com/directory/article.asp?ID=KB;EN-US;Q237863>This</A> in KB which indicates that there is a similar problem in XL2000 that was fixed in SR1. In the other thread, the SetFocus worked in my XL 2000 with SR1, but not in Andrew's without SR1. Do you have SR1 installed?
    Legare Coleman

  4. #4
    Bronze Lounger
    Join Date
    Jun 2001
    Location
    New York, New York, Lebanon
    Posts
    1,449
    Thanks
    1
    Thanked 1 Time in 1 Post

    Re: Userform in Excel 2000 (2000 (9.0.2720))

    Thanks Andrew

    I ended up moving the code from the Initialize to the Activate event, and it works OK.

    I did not think that the SendKeys "{TAB}+{TAB}", True was necessary since my control tab order was the first. But again we need people like you to keep us humble and not go insaine.

    Thanks a lot. BTW why 2 tabs? I tried 4 initially because I had 4 controls, and I thought it would cycle through, but it kept ending on the wrong control.

    Thanks again.

    Wassim
    <img src=/S/compute.gif border=0 alt=compute width=40 height=20> in the <img src=/S/bagged.gif border=0 alt=bagged width=22 height=22>

  5. #5
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Dublin, Ireland, Republic of
    Posts
    2,697
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Userform in Excel 2000 (2000 (9.0.2720))

    Wassim,

    SendKeys should not be necessary, and if you install SR1 in Office 2000 the problem is solved.

    Actually the first control has focus when the form displays, the problem is that the control will not accept input without being re-selected. {TAB}+{TAB} is Tab and Shift-Tab, so that the focus first advances to the second control and Shift-TAB back tabs to select the first control. The plus sign is interpreted by Sendkeys as the Shift key.

    Andrew C

  6. #6
    Bronze Lounger
    Join Date
    Jun 2001
    Location
    New York, New York, Lebanon
    Posts
    1,449
    Thanks
    1
    Thanked 1 Time in 1 Post

    Re: Userform in Excel 2000 (2000 (9.0.2720))

    Thanks Andrew

    I will install SR-1.

    Yes you are right + = Shift, I am having one of these bad colds... maybe I should just stop coding for today :-(

    Wassim
    <img src=/S/compute.gif border=0 alt=compute width=40 height=20> in the <img src=/S/bagged.gif border=0 alt=bagged width=22 height=22>

Posting Permissions

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