Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Read MsgBox value for Do ... Loop

Status
Not open for further replies.

Tactical

Technical User
Aug 24, 2003
36
CA
A protected project I'm using in Word displays "Reached bottom of list" in a message box. I want to incorporate that message as part of my error checking for another macro that'll exit when that message is displayed. If the project wasn't protected I could probably just incorporate its error handling but since I can't I figure this is the next best thing.

Can someone provide me with the syntax to read the message box contents?

- Iris
 
I have read that three or four times, and I have no idea what is going on.

Something causes a message box to display....whatever, it does not matter. You made it display that. Whatever is the logic that cause THAT message, can also direct instructions elsewhere.

A message box contents are created by YOU. So you can do whatever else you want logically. There is no syntax to read the contents of a message box . You put it in there.

Perhaps if you walked through this step-by-step?

Gerry
 
Gerry, I suppose Iris can speak for him/herself but I take it to mean there is an existing VBA project, which displays the MsgBox, but is password protected such that Iris does not have access to the code. If that is the case, I have no idea how to "hook" into that in a second project/macro.


Regards,
Mike
 
Download the word password recovery tool.

That is unless it is protected so you can not do what you are trying to do.

Andy

Andy Baldwin

"Testing is the most overlooked programming language on the books!
 
Mike has the correct understanding - exactly!

I was hoping something along the lines of testing for the active window maybe??

- Iris
 
I still do not understand. If the issue is the VBAProject is password protected (, then how are you going to code in it? Are you saying:

Run another different macro (in a different project???) that somehow taps into the existing macro (from a project you do not have access to) so that if the second macro detects the first (unavailable macro) display of a specific message box it does something?

If the project is unavailable because of an unknown password, then you do not have access to it. Without access to it, I do not see how you can get what you want to work. The code that displays the message box, will do so when it is told to....good dog. That is it. A messagebox display what it is told to. There is no property set, no Msgbox.Text, to be read. You can not get the contents of a message box that you can use in another macro.

Gerry
 
For me the only real issue is:
Why is the project protected with a password you don't know ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Iris,

If you are refering to the ActiveWindow property, that won't work. It may be possible to identify the MsgBox window using the Win32 API but I think the problem would be in how to trigger your detection code. In other words, it might not be possible for your code to be notified that the MsgBox has been displayed. The alternative would be for your new macro to look for the MsgBox at a point in time, but this doesn't sound like what you want it to do.


Regards,
Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top