hourglass remains after macro runs???

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

when i run the following code from the VBE (F5), it runs fine. when i run it
from a rectangle i drew on a spreadsheet in the same file, the hourglass
remains on the screen until the OK button or Close "X" is clicked.

Sub StartupPath()
MsgBox Application.StartupPath, Title:="The Excel startup path is: "
End Sub

what is causing the hourglass to remain after the msgbox is displayed?
thank you.
elizabeth
 
Hi Elizabeth,

Your code ran without problem for me, irrespective of whether it ran from
the VBE or in response to a shape click event.

Of course, in either case, the macro cannot terminate until the message box
is closed.
 
Norman:
Thanks for your reply. I should mention (although it's probably obvious)
that I am new to VBA.
When you say it "ran without a problem", do you mean the hourglass did not
remain on the screen when you ran the macro from a shape on a worksheet?
When I run the macro from the VBE or from a toolbar button, the hourglass
does not remain on the screen while waiting for me to click OK or "X". It's
only when I run the macro from a shape on a worksheet that the hourglass
remains. A tester (I'm writing procedures) thought they should wait before
clicking OK because the macro was still working & going to display something
else.
Thoughts?
Thank you.
Elizabeth
 
Hi Elizabeth,

Running your procedure from Excel (either via Alt-F8 or from a rectangle,
to simulate your scenario), I get the hourglass, indicating that the macro
is waiting for user response. Running the macro manually from the VBE, I get
the arrow cursor.

If you find this disconcerting, you could specify the cursor form.

I guess that, in analagous situations, the curssor form has never adversely
impinged for me.
 
Norman,

I once had a user sit and start at a Msgbox waiting for the hourglass to stop.
Ever since then, I change the cursor to the default before showing a Msgbox...
Elizabeth could change her code to...

Sub StartupPath()
Application.Cursor = xlDefault
MsgBox Application.StartupPath, Title:="The Excel startup path is: "
End Sub

Jim Cone
San Francisco, USA


"Norman Jones"
<[email protected]>
wrote in message

Hi Elizabeth,
Running your procedure from Excel (either via Alt-F8 or from a rectangle,
to simulate your scenario), I get the hourglass, indicating that the macro
is waiting for user response. Running the macro manually from the VBE, I get
the arrow cursor.
If you find this disconcerting, you could specify the cursor form.
I guess that, in analagous situations, the curssor form has never adversely
impinged for me.---
Regards,
Norman
 
Norman:
THANK YOU!!!
I thought my problem was the macro was in some kind of inefficient loop. It
never occured to me that it was just the cursor's appearance, or even that
the cursor's appearance can be changed. I added "Application.Cursor =
xlNorthwestArrow" before, & "Application.Cursor = xlDefault" after the msgbox
line & it now works flawlessly. Thanks again!
Elizabeth
 
Hi Jim.

I do not in any way dispute the possibility, and, after sending my reponse
to Elizabeth, it occurred to me that, over and above indivcating that the
cursor could be changed, I should have provided the requisite code.

I think that, in future, I too will proactively set the cursor.

However, in the light of your story, would you allow me to retain the
hourglass for *certain* users?
 
Hi Elizabeth,

If you look at the exchange between Jim amd me, you will see that, as result
of your posts and Jim's experience, I have decided to change the cursor in
such situations.

Jim has provided appopriate code to achieve this.

If there are any residual problems, please post back.
 
Jim:
Thank you for your response. I like your version better than mine - 1 less
line of code.
After Norman suggested changing the cursor form, I looked "cursor" up in VBE
Help. From the choices, I selected the xlNorthwestArrow since the tester & I
were expecting to see an arrow instead of an hourglass. I then reset the
cursor to the default since VBE Help said to do so.
What I haven't been able to figure out (after researching VBE Help, Google,
the Microsoft website, & my 3 ref books) is the following:
1) What does the "default" cursor mean? I can't find an option in Excel to
change the appearance of the cursor. Is it referring to the user's selection
in Control Panel | ... | Mouse | Pointers tab | Customize?
2) If that is the case, why does "Application.Cursor" work in an Excel macro
when Application (per VBE Help) refers to the Excel application, but the
Control Panel isn't the Excel application? Have I totally misunderstood VBA
basics?
Thank you for any clarification you can provide.
Elizabeth
 
Elizabeth,

I have never been much concerned with windows vs. application
cursor differences.
However, I changed the default cursor using Control panel and
discovered that Excel still used its own cursors for the spreadsheet,
but that the new cursor was used for the area immediately outside of
the spreadsheet area.
That makes sense to me, as being able to change the cursors
used on the spreadsheet could only lead to much user confusion.

When using a Userform, or an active x control, Excel offers a wider
selection of cursors to choose from.

Regards,
Jim Cone
San Francisco, USA


Jim:
Thank you for your response. I like your version better than mine - 1 less
line of code.
After Norman suggested changing the cursor form, I looked "cursor" up in VBE
Help. From the choices, I selected the xlNorthwestArrow since the tester & I
were expecting to see an arrow instead of an hourglass. I then reset the
cursor to the default since VBE Help said to do so.
What I haven't been able to figure out (after researching VBE Help, Google,
the Microsoft website, & my 3 ref books) is the following:
1) What does the "default" cursor mean? I can't find an option in Excel to
change the appearance of the cursor. Is it referring to the user's selection
in Control Panel | ... | Mouse | Pointers tab | Customize?
2) If that is the case, why does "Application.Cursor" work in an Excel macro
when Application (per VBE Help) refers to the Excel application, but the
Control Panel isn't the Excel application? Have I totally misunderstood VBA
basics?
Thank you for any clarification you can provide.
Elizabeth
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top