Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Display decimals in a msgbox | Excel Programming | |||
How to display remaining txt file which overflowed MsgBox display? | Excel Discussion (Misc queries) | |||
MsgBox Interactive | Excel Programming | |||
MsgBox Display | Excel Programming | |||
Display of $ in Msgbox | Excel Programming |