Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
how change selection when msgbox dialog box on screen?
Thanks in advance.
I have a Excel macro (user clicks on a button to run it) that opens Word and gets a couple of numbers there. Month- to-month the Word file changes in style a little bit, but they are pretty much exactly the same, so I am not too worried about the Excel macro getting the wrong number (it searchs for a string to get the number). However, I am trying to make the macro provide for the user to select another number if the one the macro chose is wrong. The old version is: Dim wordapp as New Word.Application With wordapp 'open document 'search for string "Total Amount" 'get number to right of string 'search for string "Sub amount" 'get number to right of string 'ad naseaum for about five more numbers 'quit Word End With I figure the new version can have a msgbox that will open in the front of the Word window saying "click OK if the selected number is OK (or wait five seconds), or highlight (select) another number if the selected number is wrong, then click OK", and the user can select another number, or if five seconds pass, the macro goes and gets the next number anyway (so the user doesn't have to sit at the computer the whole time and click ok a bunch of times). So I have (thanks to Magalhaes for this one) With wordapp 'open document 'search for string "Total Amount" 'get number to right of string WordApp.WordBasic.MsgBox "Click OK if good, otherwise highlight other number then click OK", 1 'quit Word End With Aside from the five second problem which I haven't thought about yet, when the msgbox is on the screen I can't change the selection (highlight another number). So that's the problem, when a msgbox (dialog box) is on the screen, I can move the dialog box around, but I can't change the selection (highlighted area). Any ideas? Another way I thought of maybe doing it is show the msgbox, disappear it, then if the user highlights another number and rightclicks the mouse, that number is used (but I would rather have something that has a msgbox displayed while the user is doing this, and the user clicks ok on the msgbox to continue instead of right-clicking) Or, I thought a form might allow the user to change the selection while a form is on the screen, but when I do UserForm1.show instead of msgbox, the screen goes back Excel, and the Word document is no longer shown. Any help on this one? To recap, I want to display a dialog box to the user with an OK button on it with the Word document underneath it, and allow the user to change the selection while the dialog box is on the screen and then click OK when done. Thanks again. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
how change selection when msgbox dialog box on screen?
Ian,
While not answering your specific query, rather than searching for strings, why don't you bookmark the document and search for the bookmarks? This will ensure that (assuming user input is correct), the routine will return the correct data. Then, no need for confirmation, waiting etc. Merely a suggestion Steve "Ian Elliott" wrote in message ... Thanks in advance. I have a Excel macro (user clicks on a button to run it) that opens Word and gets a couple of numbers there. Month- to-month the Word file changes in style a little bit, but they are pretty much exactly the same, so I am not too worried about the Excel macro getting the wrong number (it searchs for a string to get the number). However, I am trying to make the macro provide for the user to select another number if the one the macro chose is wrong. The old version is: Dim wordapp as New Word.Application With wordapp 'open document 'search for string "Total Amount" 'get number to right of string 'search for string "Sub amount" 'get number to right of string 'ad naseaum for about five more numbers 'quit Word End With I figure the new version can have a msgbox that will open in the front of the Word window saying "click OK if the selected number is OK (or wait five seconds), or highlight (select) another number if the selected number is wrong, then click OK", and the user can select another number, or if five seconds pass, the macro goes and gets the next number anyway (so the user doesn't have to sit at the computer the whole time and click ok a bunch of times). So I have (thanks to Magalhaes for this one) With wordapp 'open document 'search for string "Total Amount" 'get number to right of string WordApp.WordBasic.MsgBox "Click OK if good, otherwise highlight other number then click OK", 1 'quit Word End With Aside from the five second problem which I haven't thought about yet, when the msgbox is on the screen I can't change the selection (highlight another number). So that's the problem, when a msgbox (dialog box) is on the screen, I can move the dialog box around, but I can't change the selection (highlighted area). Any ideas? Another way I thought of maybe doing it is show the msgbox, disappear it, then if the user highlights another number and rightclicks the mouse, that number is used (but I would rather have something that has a msgbox displayed while the user is doing this, and the user clicks ok on the msgbox to continue instead of right-clicking) Or, I thought a form might allow the user to change the selection while a form is on the screen, but when I do UserForm1.show instead of msgbox, the screen goes back Excel, and the Word document is no longer shown. Any help on this one? To recap, I want to display a dialog box to the user with an OK button on it with the Word document underneath it, and allow the user to change the selection while the dialog box is on the screen and then click OK when done. Thanks again. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
dialog box selection type | Excel Discussion (Misc queries) | |||
Returning a cell address in a msgbox, by selection via inputbox Ty | Excel Discussion (Misc queries) | |||
File Open dialog box is full-screen...???? | Excel Discussion (Misc queries) | |||
why don't buttons in the header dialog box show screen tip? | Excel Discussion (Misc queries) | |||
Dialog Box Confirmation Selection | Excel Programming |