Results 1 to 5 of 5
  1. #1
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    Eugene, Oregon, USA
    Posts
    110
    Thanks
    0
    Thanked 0 Times in 0 Posts

    SpinButton Control (VBA/Office2000 SR-1)

    I have a SpinButton control in a form (linked to a text box). When the spinbutton control gains focus, the up/down arrows are each surrounded by a box. As my spinbutton control is rather small, this makes my up/down arrows hard to see. Is there a property that will keep those boxes from appearing?

    As a last resort, I've tried to take the focus away from the spinbutton control after it's clicked...

    Private Sub spnNumCopies_Change()
    Me.txtNumCopies = CStr(Me.spnNumCopies.Value)
    Me.txtNumCopies.SetFocus
    End Sub

    However, the setfocus only appears to work every other time the spinbutton is clicked. If I put a debugging breakpoint in the sub or add a messagebox prompt before the setfocus line, the setfocus does work correctly but would I need to set a timer to get this to work? What am I missing?

  2. Subscribe to our Windows Secrets Newsletter - It's Free!

    Get our unique weekly Newsletter with tips and techniques, how to's and critical updates on Windows 7, Windows 8, Windows XP, Firefox, Internet Explorer, Google, etc. Join our 480,000 subscribers!

    Excel 2013: The Missing Manual

    + Get this BONUS — free!

    Get the most of Excel! Learn about new features, basics of creating a new spreadsheet and using the infamous Ribbon in the first chapter of Excel 2013: The Missing Manual - Subscribe and download Chapter 1 for free!

  3. #2
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: SpinButton Control (VBA/Office2000 SR-1)

    A screen shot of this "box" would be helpful...
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  4. #3
    5 Star Lounger
    Join Date
    Jul 2002
    Location
    Toronto, Ontario, Canada
    Posts
    1,139
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: SpinButton Control (VBA/Office2000 SR-1)

    I think you are stuck with the "focus indicator".

    I do believe that it is part of Windows itself. Although I'm would suspect that there is an API that you could probably call to get rid if them. Unfortunately I don't know what it is, or even if you can get rid of them with APIs
    --
    Bryan Carbonnell - Toronto <img src=/S/flags/Ontario.gif border=0 alt=Ontario width=30 height=18> <img src=/S/flags/Canada.gif border=0 alt=Canada width=30 height=18>
    Unfortunately common sense isn't so common!!
    Visit my website for useful Word, Excel and Access code, templates and Add-Ins

  5. #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: SpinButton Control (VBA/Office2000 SR-1)

    This seems to work... don't ask me why! Maybe there is a timing problem that this solves?

    Private Sub SpinButton1_Change()
    Me.TextBox1.Value = Me.SpinButton1.Value
    Me.SpinButton1.SetFocus
    Me.TextBox1.SetFocus
    End Sub
    Attached Images Attached Images

  6. #5
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    Eugene, Oregon, USA
    Posts
    110
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: SpinButton Control (VBA/Office2000 SR-1)

    Thanks all for looking at this--and thank you Jefferson. The extra line solves the problem and, although I don't know why, I don't think I need to!

Posting Permissions

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