View Single Post
  #5  
Old December 16th 07, 11:55 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Way to add prompt to this macro?

Because I stupidly forgot the text for the MsgBox function's return value:

strMsg = "Do you want to run the macro to expand all the folders... ?"
If MsgBox(strMsg, vbYesNo + vbQuestion, "Expand all?") = vbYes Then
ExpandAllFolders
End If

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"StargateFan" wrote in message ...
On Sun, 16 Dec 2007 15:44:49 -0500, StargateFan
wrote:

On Sun, 16 Dec 2007 14:29:33 -0500, "Sue Mosher [MVP-Outlook]"
wrote:

Use a MsgBox statement:

Private Sub Application_Startup()
If MsgBox("Do you want to expand?", vbYesNo + vbQuestion, "Expand all?") Then
ExpandAllFolders
End If
End Sub



WOW!! That is so kewl!! I just changed the text a bit to this:
"Private Sub Application_Startup()
If MsgBox("Do you want to run the macro to expand all the
folders... ?", vbYesNo + vbQuestion, "Expand all?") Then
ExpandAllFolders
End If
End Sub"

and then it ran the macro at triple speed! Pretty kewl.

Is there a "sleep" function in vb? I'd like to add a second or 2 or
sleep before the message box comes up. This box pops up a bit too
quickly after one presses okay to enable macros.

Thanks for this! D


[snip]

Oops, didn't check it out thoroughly. The macro still runs even when
we press NO!

(

How come? g

Thanks. D

Ads