Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 47
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
dialog box selection type ORLANDO VAZQUEZ[_2_] Excel Discussion (Misc queries) 1 September 30th 09 08:24 PM
Returning a cell address in a msgbox, by selection via inputbox Ty FARAZ QURESHI Excel Discussion (Misc queries) 3 April 8th 09 12:57 PM
File Open dialog box is full-screen...???? Tiscali Excel Discussion (Misc queries) 3 May 11th 07 10:34 AM
why don't buttons in the header dialog box show screen tip? AvidStudent20885 Excel Discussion (Misc queries) 1 March 27th 06 04:01 PM
Dialog Box Confirmation Selection Annie[_2_] Excel Programming 1 August 24th 03 02:49 PM


All times are GMT +1. The time now is 05:55 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"