VBA Procedure (or Macro) to Stop Outlook from Closing?

  • Thread starter Thread starter ND Pard
  • Start date Start date
N

ND Pard

I am new to using Outlook, but have written many Access and Excel VBA
procedures.

Often, I unintenionally click the "X" close button in the upper right corner
of the application.

Outlook provides a dialog box that states, "Are you sure you want to
permanently delete all the items and subfolders in the "Deleted Items" folder?

I do NOT want to even close Outlook, much less delete items!

I would like a dialog box that allows me to cancel the closure of Outlook.

What would the VBA macro look like to cancel my unintended closure of Outlook?

Please cc your response to: (e-mail address removed)

Your response will be appreciated.
 
You could use the Outlook object model to cancel the click on File/Close,
but it doesn't offer anything cancel a click on the "X" button. Instead,
you'd have to use a lot of Win32 API calls and hook into the sent Windows
messages.

There's already a tool available for that, please see 'OLKeeper' here:
http://www.vboffice.net/product.html?lang=en

--
Best regards
Michael Bauer - MVP Outlook

: Outlook Categories? Category Manager Is Your Tool
: VBOffice Reporter for Data Analysis & Reporting
: <http://www.vboffice.net/product.html?pub=6&lang=en>


Am Thu, 10 Dec 2009 09:25:01 -0800 schrieb ND Pard:
 
http://www.brothersoft.com/outlock-for-outlook-28886.html




ND Pard wrote:

VBA Procedure (or Macro) to Stop Outlook from Closing?
10-Dec-09

I am new to using Outlook, but have written many Access and Excel VB
procedures

Often, I unintenionally click the "X" close button in the upper right corne
of the application

Outlook provides a dialog box that states, "Are you sure you want t
permanently delete all the items and subfolders in the "Deleted Items" folder

I do NOT want to even close Outlook, much less delete items

I would like a dialog box that allows me to cancel the closure of Outlook

What would the VBA macro look like to cancel my unintended closure of Outlook

Please cc your response to: (e-mail address removed)

Your response will be appreciated.

Previous Posts In This Thread:


Submitted via EggHeadCafe - Software Developer Portal of Choice
SQLITE 3 for Compact Framework Available
http://www.eggheadcafe.com/tutorial...9-2d79749c55b5/sqlite-3-for-compact-fram.aspx
 
Back
Top