Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 2nd, 2003, 11:29 AM
Registered User
 
Join Date: Dec 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to rubymist3
Default HourGlass Mouse Pointer Help

I created a VB Application in Excel. I have a combo box called ExistingScript_cbo which is populated with names from an Oracle database. Because it takes a few seconds to actually connect and drop down with the list, I have been told by users that they think their screen freezes. I am trying to code that when the user clicks on the combo box arrow, an hour glass will appear until the request is satisfied.
The following code isn't really doing anything for me although it compiles fine:

Private Sub existingScript_cbo_Click()

    If IsNull(ExistingScript_cbo.Value)= False Then
        ExistingScript_cbo.MousePointer = fmMousePointerHourGlass
    Else
        ExistingScript_cbo.MousePointer = fmMousePointerDefault
    End If

End Sub

I also need to make sure it goes back to the arrow once the drop down list comes up. Any ideas?


Thanks,
TechGirl
 
Old December 2nd, 2003, 11:39 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 132
Thanks: 0
Thanked 0 Times in 0 Posts
Default

TechGirl,

try using
Code:
 Application.Cursor xlWait
It makes more sense than tying the cursor just to the dropdown, because Excel isn't going to be doing anything else while it's off populating the list for you.

HTH

Chris


There are two secrets to success in this world:
1. Never tell everything you know
 
Old December 2nd, 2003, 12:08 PM
Registered User
 
Join Date: Dec 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to rubymist3
Default

Thanks chrislepingwell.
I had tried that before but that alone keeps the hourglass up the entire time and even selects names from the list with the hour glass. I need it to go back to the arrow once the drop down box is populated. I tried using the following code but still not doing very good:

    Application.Cursor = xlWait
    Application.Wait Now + TimeValue("0:00:03")
    Application.Cursor = xlDefault

It never changes to the hourglass but waits 3 seconds..
Any ideas?


Thanks,
TechGirl
 
Old December 2nd, 2003, 12:12 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 132
Thanks: 0
Thanked 0 Times in 0 Posts
Default

OK, I think you need to re-organise your code a little.

First off, create a subroutine to populate the dropdown. In this routine use
Code:
Application.Cursor = xlWait
code to populate dropdown
...
Application.Cursor = xlDefault
Then add a call to that routine from the dropdown's Click event. This should ensure that the hourglass is only shown for the duration of the populating event.
 
Old December 2nd, 2003, 12:23 PM
Registered User
 
Join Date: Dec 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to rubymist3
Default

Beautiful..

That works great.. Thanks a lot!
Don't know what I was thinking..

:)



Thanks,
TechGirl





Similar Threads
Thread Thread Starter Forum Replies Last Post
Hourglass with C# khautinh C# 2 October 3rd, 2007 02:35 AM
Pointer fReqZz C++ Programming 5 June 5th, 2007 01:09 AM
Preventing operations with Hourglass Mousepointer krithi20 Pro VB 6 5 August 23rd, 2005 04:50 PM
Hourglass cursor toekneel Crystal Reports 6 October 14th, 2004 01:39 PM
Moving the mouse pointer interrupt Javascript How-To 7 August 26th, 2004 07:37 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.