Hi,
I have an application in excel vba where i show the user a msgbox. However, when the user clicks ok the msgbox stays on the screen. Any ideas how to get it to disappear?
Hi,
I have an application in excel vba where i show the user a msgbox. However, when the user clicks ok the msgbox stays on the screen. Any ideas how to get it to disappear?
I think it will be helpful if you shared the code that shows the message box as well as code that handles the vbok response...
Regards,
Vandan
code is shown below
![]()
Please Login or Register to view this content.
I don't see anything wrong with your msgbox command.
If you Debug-> Step into (F8) through your code, I bet you will find that the message box appears because the next file is also bad file...
there is only a single bad file.......i know cause i created the test and i know there is only a single bad file.
i have readon some posts that if following a msgbox there is "intense" code (not sure what this means) that sometimes the msgbox will stay on the screen.........
to be honest i am at a loss......the msgbox stays on the screen until the program stops running or until another msgbox is displayed. i thought it might have something to do with screen updating so this is why i turned it on before showing the msgbox...........at a loss..........any ideas?
Is it possible for you to upload the file? This will make troubleshooting easier.
If not, have you tried stepping through the code using F8? That might help you pinpoint the problem.
no the code is part of a larger program.....cant load it up......but i will try the stepping through.....
any other ideas?
Let's see what stepping through the code tells us...if that isn't useful let me know and I will call on others to help.
as best i can tell the msgbox went away but not sure. i ran it twice the first time i ran it where the vba code showed on my screen the msgbox came up i hit ok and then pressed F8 and it went away....
the 2nd time i ran it where the spreadsheet was visible and this kinda did nto workl.........i could not step through it.
so not sure the result.
I have asked others to look at this issue. Hopefully somebody can help you solve this for good.
Try this and see if this works:
sometimes I have found that the system need a second to wake up![]()
Please Login or Register to view this content.
Last edited by abousetta; 07-10-2012 at 09:17 PM.
Please consider:
Thanking those who helped you. Click the star icon in the lower left part of the contributor's post and add Reputation.
Cleaning up when you're done. Mark your thread [SOLVED] if you received your answer.
i got a type mismatch error when i tried the code you presented. but it did give me an idea.
instead of putting the screenupdating prior to the msgbox i put it after it and IT WORKED!
here is the code which
![]()
Please Login or Register to view this content.
any ideas why this works?
It should have been timevalue instead of time. I have changed it above.
Glad it all worked out. If you are satisfied with the results then please mark the thread as solved.
Also we have a competition this month on Excel Forum, please stop by and click on the like button of the tips you find of benefit.
Good luck.
abousetta
In the code module for "udpate_bad_file_array()", which you were calling after turning ScreenUpdating to True originally, is there a line setting it back to False?
Also note that "update" is spelled incorrectly. Gotta be careful.
Option explicit on the top of your code should catch a lot of these simple mistakes.
Technically it wouldn't catch that mistake as long as you named the actual routine in the same incorrect way.![]()
and I think that's the case in this situation since it compiled
thanks for the info. i checked that other procedure and it did not have an assignment to turn off updating.......but that was a good idea to check. thanks.
abousetta ,
i tried out your code update and it does not create a runtime error thanks.
guess i will never know why adding "screen updating" AFTER made the msgbox go away. do you think its just a timing issue?
Screenupdating can be turned on and off while the code is running. It is all ways on before the sub runs and will all ways turn on again after the all subs finish even if you don't tell it to turn on again. If you want to debug it then step through your code from the top to bottom and see where you turn Screenupdating on and off.
From experience I have noticed that sometimes with screenupdating off, message boxes, input boxes, etc. will appear on the screen even after the user click OK or Cancel.
Hope this helps.
abousetta
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks