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

    Changing Mouse Pointer

    I can't get the mouse pointer to change to the hourglass with this Word 97 VBA statement:

    Me.MousePointer = fmMousePointerHourGlass

    Can anyone give me a pointer or two on how to make this work? I want to open a form that has initialize code that retrieves names from an Exchange public folder. It takes up to 3 seconds, so I need to show the user something besides a "frozen" screen. I figured the hourglass mouse pointer would do, but I'm lost. Thanks.
    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>

  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: Changing Mouse Pointer

    It works for me, in 2000, but only while the pointer is over the UserForm. To make a change outside of the UserForm context might require the Windows API.

  3. #3
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Changing Mouse Pointer

    All my GUIs have code that lets the user change the mouse pointer. You could adapt the few lines to make a change to a pointer of your choice (don't see why it shouldn't be an hour-glass) just before you enter a lengthy period and set it back when you return. let me know and I'll post it here.

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

    Re: Changing Mouse Pointer

    Chris, if you don't mind, post your mousepointer code. I need some ideas, because Word just won't get off the stick here. But let me explain the situation.

    User clicks check box to populate a combobox with names and addresses from Outlook. Different check boxes get names from different Outlook folders. The first line of checkbox code sets the mousepointer:

    me.MousePointer = fmMousePointerHourGlass

    The next line call the routine to get the names in an array and shoves 'em into the appropriate combobox. Then sets the pointer back. The mouse pointer never changes from the arrow! If I remove the pointer reset line, the form will have the hourglass pointer after the combo is populated. Go figure. Is my PC to fast for VBA to refresh the screen? I tried .repaint. No good.
    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>

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

    Re: Changing Mouse Pointer

    Jeff, see my post below to Chris if you've got the inclination to take a look at this again. Thanks.
    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>

  6. #6
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Changing Mouse Pointer

    > post your mousepointer code.

    I don't mind, but you might regret it (grin!)



    Herewith some ideas.


    Or "pointers" as we say in the trade .....



    I carved a gob of code out of my Fun4X and noticed that I make references both to "MousePointer" and to "MouseIcon". That in itself may be enough to cause confusion. I'm new here myself.

    Attached to this message ought to be a PKZip file containing a Word97SR2 document KevinMouse.doc.

    Within there is a macro "aaaTest". Run this. There will be clicking and whirring for up to 60 seconds while the code searches your Drive C: for *.ICO files, after which a GUI pops up.

    Click once on an item on the list, then hover the mouse over the OK button.

    When you've found a Pointer? Icon? to your liking click on the OK button.

    A MsgBox will throw up the selected file name.

    You'll notice that I "fmMousePointerCustom 99 Uses the icon specified by the MouseIcon property."

    I haven't tried it with any other Custom pointer, and I don't know if the HourGlass is available as an Icon file.


    <pre>Private Sub lbIconNames_Click()
    Me.cmdOK.MousePointer = 99
    Me.cmdOK.MouseIcon = LoadPicture(Me.lbIconNames.List(Me.lbIconNames.Lis tIndex))
    Me.cmdCancel.MousePointer = 0
    End Sub
    </pre>



    Say "Thank you, Chris, for not including all 24 drives on the search for Icons".

    You're welcome!!
    Attached Files Attached Files

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

    Re: Changing Mouse Pointer

    Chris,

    The code bombs out with "Bad file name or number". On error condition, your strFile var contains "?". How many chars can a VBA string contain? The strFile var is really long (I have lots of folders). So, testing halted. No time for further debugging right now.
    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>

  8. #8
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Changing Mouse Pointer

    I d/l directly from the lounge attachment and ran it again; no problems.

    Did you really mean "strFile" or did you mean "strDirs". The latter is the one that gets to grow.

    I got bored with the little routine below after it passed the 4,000,000 mark. How many files/directories/levels do you have?


    <pre>Sub aaaatest2()
    Dim strtext As String
    While True
    strtext = strtext & String(10000, " ")
    Application.StatusBar = Len(strtext)
    Wend
    End Sub
    </pre>


  9. #9
    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: Changing Mouse Pointer

    Hey - in my earlier, the scenario was too simple. Something like this -

    Private Sub CommandButton1_Click()
    If UserForm1.MousePointer <> fmMousePointerHourGlass Then
    UserForm1.MousePointer = fmMousePointerHourGlass
    Else
    UserForm1.MousePointer = fmMousePointerDefault
    End If
    End Sub

    - works perfectly fine. But if you call or use that code in a different procedure, whether from inside the form module or as a public procedure in another module, it does not work. Using UserForm1.Repaint or Application.ScreenRefresh is futile. Why? It seems that Office or Windows waits until the triggered event (in my case, clicking the command button) has run to completion before changing the pointer.

    Major frustration; I feel your pain. I do not see a quick solution to this.

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

    Re: Changing Mouse Pointer

    I meant strFile. It's got a value of "?" and strDirs has a 397 character long value of

    "c:WINNTsystem32,c:WINNTsystem,c:WINNTrepair,c:WIN NTHelp,c:WINNTConfig,c:WINNTmsagent,c:WINNTCursors ,c:WINNTMedia,c:WINNTjava,c:WINNTaddins,c:WINNTCon nection Wizard,c:WINNTDriver Cache,c:WINNTsecurity,c:WINNTTemp,c:WINNTtwain_32, c:WINNTAppPatch,c:WINNTDebug,c:WINNTTwain32,c:WINN TA5W_DATA,c:WINNTSpeech,c:WINNTShellNew,c:WINNTInt ernet Logs,c:WINNTVbox,"
    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>

  11. #11
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Changing Mouse Pointer

    Hmmm. It's been running for over a year here on a Win95/Word97SR2 beige thing.

    What are you running on? can you get to an inferior machine, close to me specs?

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

    Re: Changing Mouse Pointer

    I've started a new post on this topic -- the resolution to the issue.
    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>

Posting Permissions

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