Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Ignore MsgBox if run by automation

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
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
how can I get a msgbox? AND Excel Discussion (Misc queries) 0 February 12th 09 12:47 PM
VB - ignore a msgbox prompt Kevin Excel Discussion (Misc queries) 3 January 10th 08 11:47 AM
msgbox James Coughlan Excel Discussion (Misc queries) 3 May 3rd 06 01:57 PM
Help with MsgBox... tjb Excel Worksheet Functions 3 December 29th 04 03:43 PM
Ignore MsgBox if run by automation Dan E[_2_] Excel Programming 0 July 22nd 03 11:42 PM


All times are GMT +1. The time now is 12:34 AM.

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

About Us

"It's about Microsoft Excel"