Results 1 to 7 of 7
  1. #1
    Silver Lounger
    Join Date
    Jul 2001
    Location
    Ottawa, Ontario, Canada
    Posts
    1,609
    Thanks
    0
    Thanked 1 Time in 1 Post

    Cursor Behaviour (VBA/Word/SP3)

    <div style="width: 100%; background-color: #FFFFFF;"><code><font color=black><font color=blue>Option</font color=blue> <font color=blue>Explicit</font color=blue>
    <font color=blue>Public</font color=blue> <font color=blue>Sub</font color=blue> CursorDemo()
    <font color=blue>Dim</font color=blue> Ctr <font color=blue>As</font color=blue> <font color=blue>Byte</font color=blue>
    <font color=blue>Dim</font color=blue> mt <font color=blue>As</font color=blue> <font color=blue>Single</font color=blue>

    <font color=blue>For</font color=blue> Ctr = 1 <font color=blue>To</font color=blue> 3
    MsgBox "Wait1"
    System.Cursor = wdCursorWait
    mt = Timer
    <font color=blue>Do</font color=blue> <font color=blue>While</font color=blue> Timer - mt < 2
    <font color=blue>Loop</font color=blue>

    MsgBox "Beam"
    System.Cursor = wdCursorIBeam
    mt = Timer
    <font color=blue>Do</font color=blue> <font color=blue>While</font color=blue> Timer - mt < 2
    <font color=blue>Loop</font color=blue>

    MsgBox "Wait2"
    System.Cursor = wdCursorWait
    mt = Timer
    <font color=blue>Do</font color=blue> <font color=blue>While</font color=blue> Timer - mt < 2
    <font color=blue>Loop</font color=blue>

    MsgBox "Normal"
    System.Cursor = wdCursorNormal
    mt = Timer
    <font color=blue>Do</font color=blue> <font color=blue>While</font color=blue> Timer - mt < 2
    <font color=blue>Loop</font color=blue>

    MsgBox "NW Arrow"
    System.Cursor = wdCursorNorthwestArrow
    mt = Timer
    <font color=blue>Do</font color=blue> <font color=blue>While</font color=blue> Timer - mt < 2
    <font color=blue>Loop</font color=blue>

    MsgBox "Normal"
    System.Cursor = wdCursorNormal
    mt = Timer
    <font color=blue>Do</font color=blue> <font color=blue>While</font color=blue> Timer - mt < 2
    <font color=blue>Loop</font color=blue>

    MsgBox "Wait3"
    System.Cursor = wdCursorWait
    mt = Timer
    <font color=blue>Do</font color=blue> <font color=blue>While</font color=blue> Timer - mt < 2
    <font color=blue>Loop</font color=blue>

    <font color=blue>Next</font color=blue> Ctr
    <font color=blue>End</font color=blue> <font color=blue>Sub</font color=blue>
    </font color=black></code></div hiblock>
    Can someone tell me why this code fails to consistently change the cursor to an hourglass when called upon to do so. See the highlighted cells in the following table.
    Attached Images Attached Images
    Regards
    Don

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Cursor Behaviour (VBA/Word/SP3)

    Try inserting a line

    DoEvents

    either before the Do ... Loop or inside the loop.

  3. #3
    Silver Lounger
    Join Date
    Jul 2001
    Location
    Ottawa, Ontario, Canada
    Posts
    1,609
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Cursor Behaviour (VBA/Word/SP3)

    Hi Hans

    The DoEvents didn't do it. This System.Cursor has me totally confused. No great feat these days. <img src=/S/confused3.gif border=0 alt=confused3 width=45 height=45>
    Regards
    Don

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Cursor Behaviour (VBA/Word/SP3)

    Strange - it worked for me with the code you posted. (I did see exactly the same behavior that you reported with the original code).

  5. #5
    Silver Lounger
    Join Date
    Jul 2001
    Location
    Ottawa, Ontario, Canada
    Posts
    1,609
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Cursor Behaviour (VBA/Word/SP3)

    Hi Hans
    Perhaps you might take another look at this problem.

    The table in my initial post only told part of the story, in that I now realize that the cursor displayed while displaying the MsgBox is inconsistent.

    When I insert the DoEvents commands the results change, and are consistent when placed in either location which you suggested; though they are not the results which I would expect.

    The attached file contains the results which I expect, and the results obtained with and without the DoEvents commands. It also contains the original code which I posted with the addition of the DoEvents commands and a final MsgBox to remove any ambiguity regarding the final cursor of the test.

    During all tests the cursor was hovering over the document, away from the MsgBox.

    When the cursor was moved over the MsgBox it consistently displayed as a pointer -- as expected.
    Attached Files Attached Files
    Regards
    Don

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Cursor Behaviour (VBA/Word/SP3)

    I get even less predictable results now, so I can only conclude that System.Cursor is broken, and that you shouldn't rely on it in your code.

  7. #7
    Silver Lounger
    Join Date
    Jul 2001
    Location
    Ottawa, Ontario, Canada
    Posts
    1,609
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Cursor Behaviour (VBA/Word/SP3)

    Misery loves company. I'm relieved to hear that it's not just my machine. <img src=/S/igiveup.gif border=0 alt=igiveup width=31 height=23>
    Regards
    Don

Posting Permissions

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