Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default How to inhibit non-interactive MsgBox display

I'm using a VBScript to start an excel macro (opening a workbook that
automatically runs via Workbook_Open()). This macro opens another
workbook and runs a macro in it, call it macro A. Macro A generates
an informational message with a MsgBox display. Since this is running
as a non-interactive session, I need to inhibit the display of this
MsgBox. I've tried DisplayAlerts=False and that doesn't do it. How
can I inhibit this MsgBox?

Denis
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default How to inhibit non-interactive MsgBox display

Denis,

You need to write your code to not show it if the macro is run by other code - to do so, you could
pass it a parameter

Sub MacroA(ShowMsg As Boolean)

If ShowMsg Then Msgbox "Hello there"



Then call it like

MacroA False

HTH,
Bernie
MS Excel MVP


"Denis" wrote in message
...
I'm using a VBScript to start an excel macro (opening a workbook that
automatically runs via Workbook_Open()). This macro opens another
workbook and runs a macro in it, call it macro A. Macro A generates
an informational message with a MsgBox display. Since this is running
as a non-interactive session, I need to inhibit the display of this
MsgBox. I've tried DisplayAlerts=False and that doesn't do it. How
can I inhibit this MsgBox?

Denis



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default How to inhibit non-interactive MsgBox display

Sorry, I forgot to add that you'll need another macro to call the macro to show the msgbox

Sub CallMacroA()
MacroA True
End Sub

HTH,
Bernie
MS Excel MVP


"Bernie Deitrick" <deitbe @ consumer dot org wrote in message
...
Denis,

You need to write your code to not show it if the macro is run by other code - to do so, you could
pass it a parameter

Sub MacroA(ShowMsg As Boolean)

If ShowMsg Then Msgbox "Hello there"



Then call it like

MacroA False

HTH,
Bernie
MS Excel MVP


"Denis" wrote in message
...
I'm using a VBScript to start an excel macro (opening a workbook that
automatically runs via Workbook_Open()). This macro opens another
workbook and runs a macro in it, call it macro A. Macro A generates
an informational message with a MsgBox display. Since this is running
as a non-interactive session, I need to inhibit the display of this
MsgBox. I've tried DisplayAlerts=False and that doesn't do it. How
can I inhibit this MsgBox?

Denis





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default How to inhibit non-interactive MsgBox display

On Nov 14, 9:31 am, "Bernie Deitrick" <deitbe @ consumer dot org
wrote:
Denis,

You need to write your code to not show it if the macro is run by other code - to do so, you could
pass it a parameter

Sub MacroA(ShowMsg As Boolean)

If ShowMsg Then Msgbox "Hello there"

Then call it like

MacroA False

HTH,
Bernie
MS Excel MVP


Is there a way for a macro to detect that it is being run in a non-
interactive session? If there is that would allow the MsgBox to be
generated conditionally. That would be a much better solution in this
case than having to create a parameter to control the conditional
generation (there are a number of messages that fall in this category)

Denis
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default How to inhibit non-interactive MsgBox display

You could use a global boolean, say

Public InterActiveMode As Boolean

Then use

InterActiveMode = True

when you are in you interactive mode, and

InterActiveMode = False

when you are not (How you determine that depends on how you use your project...)

Then start each MsgBox statements with

If InterActiveMode Then

along the lines of

If InterActiveMode Then MsgBox "This is my message"


HTH,
Bernie
MS Excel MVP


"Denis" wrote in message
...
On Nov 14, 9:31 am, "Bernie Deitrick" <deitbe @ consumer dot org
wrote:
Denis,

You need to write your code to not show it if the macro is run by other code - to do so, you
could
pass it a parameter

Sub MacroA(ShowMsg As Boolean)

If ShowMsg Then Msgbox "Hello there"

Then call it like

MacroA False

HTH,
Bernie
MS Excel MVP


Is there a way for a macro to detect that it is being run in a non-
interactive session? If there is that would allow the MsgBox to be
generated conditionally. That would be a much better solution in this
case than having to create a parameter to control the conditional
generation (there are a number of messages that fall in this category)

Denis



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
Display decimals in a msgbox Simon Lloyd[_902_] Excel Programming 0 December 7th 06 07:52 PM
How to display remaining txt file which overflowed MsgBox display? EagleOne Excel Discussion (Misc queries) 1 November 2nd 06 01:10 PM
MsgBox Interactive [email protected] Excel Programming 1 August 21st 06 05:12 PM
MsgBox Display Michael S. Excel Programming 2 June 16th 05 10:55 PM
Display of $ in Msgbox David Excel Programming 2 September 8th 04 09:38 AM


All times are GMT +1. The time now is 03:01 AM.

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

About Us

"It's about Microsoft Excel"