Hello, In MS WORD (version 2003), I am trying to use a Windows API MessageBoxA function in place of the VBA built-in MsgBox() function. Why? I want the message box to be modeless so that user can select text inconjunction w/ the operating macro, and, to me, building a UserForm for these multiple user interactive tasks is much too cumbersome.
This API approach works OK, except for one issue. When I run the macro and move my mouse outside of the MB window, the cursor is displayed as an HOURGLASS. The HOURGLASS will confuse the user. What can I do to get the HOURGLASS to turn back to a normal arrow cursor.
NOTE: If I right-click when outside of the API window and then left-click, the HOURGLASS goes away. ... Also, if the macro is started while in the VB editor window, then the HOURGLASS never occurs. So, seems like there would be a way to avoid this hourglass.
Any help is greatly appreciated. ... Thank you, sauerj
PS: See attachment which contains the macro containing these MessageBox API functions.
Cross-Post LINK: http://www.msofficeforums.com/word/5...-function.html
SOLVED ... Found My Own Solution: See post below (from sauerj) for details!
![]()
Last edited by sauerj; 11-10-2010 at 08:44 AM. Reason: Added Cross-Post Link
One test is worth a thousand opinions.
Click the * below to say thanks.
If I put System.Cursor = wdCursorNormal ahead of the API MsgBox function (see code below), it does remove the hourglass, BUT only after hovering the mouse over the MsgBox window. Any other ideas to avoid the hourglass 100%????
Is there something about how the API HANDLE is setup that impacts this????
System.Cursor = wdCursorNormal UserPromptCommand = APIMsgBox(prompt:="Select insertion range where you want to insert cross-reference." & _ Chr(13) & Chr(13) & "Hit OK when complete and ready for macro to continue" & Chr(13) & _ "Hit CANCEL to QUIT.", buttons:=vbOKCancel + vbInformation + vbDefaultButton2 + vbSystemModal, _ title:="Cross Reference: ... Prompt user to select insertion range") 'Instruct user
Found My Own Solution:
Sending ALT key removed the last instance of the HOURGLASS.
In the end, gave up on API Message Box and switched to using a User Form for this. Didn't like that API Message Box kept putting box back in the CENTER of the window (which requires user to move it every time). For multiple user interactions, this was unacceptable. The Form technique fixed all of this. However, don't like that VBA BEEP command makes NO NOISE; but that's small potatoes. ... sauerj
System.Cursor = wdCursorNormal SendKeys "%" UserPromptCommand = APIMsgBox(prompt:="Select insertion range where you want to insert cross-reference." & _ Chr(13) & Chr(13) & "Hit OK when complete and ready for macro to continue" & Chr(13) & _ "Hit CANCEL to QUIT.", buttons:=vbOKCancel + vbInformation + vbDefaultButton2 + vbSystemModal, _ title:="Cross Reference: ... Prompt user to select insertion range") 'Instruct user
Last edited by sauerj; 11-10-2010 at 08:45 AM.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks