Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
In a general module (probably the one with your code) put in a public
variable Public bRunByOpen as Boolean in the workbook.Open Event then Private Sub Workbook_Open() bRunByOpen = True mymacro End Sub In your current routine in a general module dim res as variant if not bRunByOpen then res = MsgBox("Do you want to send this report?, vbYesNo) else res = vbYes bRunByOpen = False end if if res = vbYes then ' code to send report End if -- Regards, Tom Ogilvy Tod wrote in message ... I have something like this: If MsgBox("Do you want to send this report?", vbYesNo) = vbYes Then 'Code to send report End If When the code is being executed from a button on the worksheet, it will give the user the choice. However, I also have a script that opens this workbook each morning and runs the same procedure. Is there a way I can have the procedure know it's being run by a script and accept the default (which I think is Yes)? tod |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
how can I get a msgbox? | Excel Discussion (Misc queries) | |||
VB - ignore a msgbox prompt | Excel Discussion (Misc queries) | |||
msgbox | Excel Discussion (Misc queries) | |||
Help with MsgBox... | Excel Worksheet Functions | |||
Ignore MsgBox if run by automation | Excel Programming |