PDA

View Full Version : Temporarily disable the receiving of emails



RobBlakemore
02-25-2011, 09:06 AM
Hi,

I would like to have the ability to temporarily disable the receiving of emails, and then automatically re-enable the receiving of emails after one hour.

The purpose of this is to stop me getting majorly distracted by emails and stopping me doing proper work!

However, it’s essential that emails are received again after one hour - so I don’t forget it's off, and miss something really important.

I can find nothing like this functionality anywhere on the internet. I’ve thought of one simple way of doing this through a macro:-

1. Set “Work Offline” to be enabled.
2. Wait for one hour
3. Set “Work Offline” to be disabled.

If anyone can provide the code to do this, I’d be amazed and really grateful. I can’t find the VB to do it anywhere on the web.

Many Thanks,


Rob

JP2112
02-25-2011, 09:56 AM
What type of email account are you working with? Exchange server, POP3, something else?

Note that there may be better ways to handle this. For example, lengthening the time between email server pings and turning off desktop notifications can limit the amount of distractions caused by email.

RobBlakemore
02-25-2011, 11:12 AM
Working with a company-configured Exchange server.

When you say "lengthen the time between email server pings", if this is something configured at the Exchange side, I won't be able to access that setting. If it is client side, please can you point me at it so I can give it a go.

Also, if anyone knows the VB code to do this, I'd be very interested to see it.

Many thanks for your reply.

JP2112
02-25-2011, 11:39 AM
Sorry, with an Exchange email account you must restart Outlook to switch between working offline and online (according to Outlook Help, anyway).

You can switch it on like this:


Sub NowOffline()
Dim ctl As Office.CommandBarControl
Set ctl = ActiveExplorer.CommandBars.FindControl(, 5613)
If ctl.Enabled Then
ctl.Execute
End If
End Sub


But you have to restart to turn it back on, and there's no way to do that with VBA in Outlook.

You might also try this solution, which moves the "Work Offline" button to a toolbar:

http://www.experts-exchange.com/Software/Office_Productivity/Groupware/Outlook/Q_23204264.html

But this would only turn it on (if Outlook's Help is correct), you would still need to restart to turn it off.

You could also try temporarily disabling send/receive for as long as you like. Here's the code:


Sub ScheduledSendReceiveToggle()
Dim ctl As Office.CommandBarControl
Set ctl = ActiveExplorer.CommandBars.FindControl(, 6867)
If ctl.Enabled Then
ctl.Execute
End If
End Sub


Run it once to turn off send/receive, run it again to turn it back on. I didn't test this code, however, other than to verify that it toggles the setting.

You didn't say your Outlook version, but in Outlook 2003 to lengthen the amount of time between email checks, go to Tools > Send/Receive > Send/Receive Settings > Define Send/Receive Groups (or just press Ctrl+Alt+S) and look for "Schedule an automatic send/receive every [ ] minutes" and change the number in the box.

Sorry to disappoint you, but Outlook's object model is very limited compared to the other VBA-aware programs, there are many things you simply can't do in Outlook using VBA.

RobBlakemore
03-10-2011, 12:36 PM
Thank you very much for your reply. It's very much appreciated.

However, it hasn't yet worked.

I'm using Outlook 2010 with an Exchange Server.

My experience is that when an Exchange Server is used, the connection is permanent. New emails are pushed constantly. I get new email every few seconds, certainly not every 15 minutes, so the approach you suggest cannot work.

There MUST be some way of temporarily turning off the receiving of email if connected to an Exchange Server, by settings, or by VBA.

SURELY ?!!!

JP2112
03-10-2011, 05:36 PM
Every Outlook version lets you specify the time interval between email send/receive. It doesn't matter that you're using Exchange. Here's one article I found that shows you how to do this:

http://blogmines.com/blog/2010/04/29/how-to-change-the-send-and-receive-emails-settings-in-outlook-2010/

RobBlakemore
03-11-2011, 05:09 AM
Many thanks for the reply, but this does NOT do what I want.

I already know that every version of Outlook contains a setting to allow a time interval to be set between send/receive. But when I'm connected to an Exchange Server, that option makes NO difference to when I receive emails.

[That setting on my computer currently reads "every 15 minutes". Yet I receive new email as soon as it arrives. Like every 10 seconds. Regardless of whatever value the setting you've mentioned is set to.]

There MUST be some way of temporarily turning off the receiving of email if connected to an Exchange Server, by settings, or by VBA. Surely someone has worked out how to do this seemingly simple task!?

All thoughts appreciated.

JP2112
03-16-2011, 08:08 AM
I'm using Outlook 2003 with Exchange, and it works for me. It might be a setting specific to 2010, or something with your Exchange server that overrides the local setting.

The only suggestion I have left (short of asking your Exchange admin about it) is to turn off the desktop notification of new messages. That won't stop emails from coming in, but the popups will stop. Then you can just maximize Outlook whenever you want to "check" emails. I found a tutorial here:

http://www.itechtalk.com/thread9847.html