ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Suppressing Msgbox during Testing (https://www.excelbanter.com/excel-programming/273841-re-suppressing-msgbox-during-testing.html)

John Wilson

Suppressing Msgbox during Testing
 
Tim,

For a multi-user (LAN) environment, I usually set a public variable
such as Public TestMode as Boolean and set it via my UserName.
If Application.UserName = "John Wilson" Then TestMode = True
Then when I put my message boxes in, I preface them all with
If TestMode = True Then MsgBox "blah, blah, blah"
I do the same with subroutines that aren't quite ready for prime time.
In a single user environment, you could just go into the VBA editor
and set TestMode to true whenever you want to test.
Easiest thing about doing it this way is that you can leave the
message boxes there for later testing and they won't affect anyone.
Just a thought. I'm sure there are many other ways.

John

Tim Childs wrote:

Hi

Please can someone provide a code snipprt or an idea to solve this neatly

I have a utility that does some predetermined formatting on generic
worksheets. In normal use it is used on ONE sheet at a time by the user.
S/he may then use it later on another sheet.

I want to test modifications against a set of sheets in a workbook
consecutively in one go, which is fine but the routine itself has a MSGBOX
command in it if it finds a particalar condition. I need to suppress this in
the multi-sheet test. Otherwise it will be stopping unnecessarily as I would
test that Msgbox condition independently.

Can someone provide a suggestion,pl?

Pl post back if above is not clear enough to enable a response.

Thanks

Tim




All times are GMT +1. The time now is 12:01 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com