Enable all rules from toolbar button?

Status
Not open for further replies.

soadfan

Member
Outlook version
Outlook 2013 64 bit
Email Account
Office 365 Exchange
Hello there,
i have this issue which is described HERE (a screenshot of a MSO forum's thread)


Just for info i've added and 3 sec delay, but no luck:

Code:
Public Sub saveAttachtoDiskNL(itm As Outlook.MailItem)
Debug.Print "*** START NL_STT"
Dim objAtt As Outlook.Attachment
Dim saveFolder As String
Dim dateFormat
Dim yearFolder
dateFormat = Format(itm.ReceivedTime, "dd-mm-yyyy_hh-mm-ss-AMPM_")
yearFolder = Format(itm.ReceivedTime, "yyyy-mm")
saveFolder = "D:\TLC\STT_NL\" & yearFolder & "\"
On Error Resume Next
MkDir saveFolder
On Error GoTo 0
  For Each objAtt In itm.attachments
  Debug.Print "Found: " & objAtt.FileName & " at " & dateFormat
  If LCase(Right(objAtt.FileName, 4)) <> ".jpg" And LCase(Right(objAtt.FileName, 4)) <> ".png" Then
  Debug.Print "Confirmed as acceptable file type: " & objAtt.FileName & " at " & dateFormat
  objAtt.SaveAsFile saveFolder & dateFormat & "STT_NL" & LCase(Right(objAtt.FileName, 4))
  Debug.Print "Successful save: " & objAtt.FileName & " at " & dateFormat
  Debug.Print "Before wait:"; Now
  Call WaitFor(3)
  Debug.Print "After wait:"; Now
  Set objAtt = Nothing
  Debug.Print "Set objAtt = Nothing"
  Debug.Print "-------------------------------------------------------------------------------------------"
  End If
  Next
End Sub
and log:

Code:
*** START NL_STT
Found: WORKBOOK_4YX80QR9J004S642E8Q6AYLNX.ZIP at 16-06-2016_06-34-10-AM_
Confirmed as acceptable file type: WORKBOOK_4YX80QR9J004S642E8Q6AYLNX.ZIP at 16-06-2016_06-34-10-AM_
Successful save: WORKBOOK_4YX80QR9J004S642E8Q6AYLNX.ZIP at 16-06-2016_06-34-10-AM_
Before wait:Mon 16 June 06:34:38 AM
After wait:Mon 16 June 06:34:41 AM
Set objAtt = Nothing
-------------------------------------------------------------------------------------------
Now if i can't make it w0rk i want to be able to enable all disabled rules with one click.
Can anyone help with code for this?

P.S. I tried few google results and tried to adapt them to my needs, but also with no luck

Best regards,
Peter
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
I would not delay the macro, at least not within the rule script. It causes outlook to wait and if two messages arrive at once, rules may not run on it.

I would use the rule's script to call the macro that does the work. This passes the work to a macro outside of the rule. It helped when i categorized Yammer messages based on the yammer group - failure rate dropped a lot, but there were still a few failures. (I received hundreds of messages a day from yammer, so it was always running.)


Code:
Public Sub saveAttachtoDiskNL(itm As Outlook.MailItem)
myMacro itm
End Sub

Public Sub myMacro(itm As Outlook.MailItem)
Debug.Print "*** START NL_STT"
Dim objAtt As Outlook.Attachment
Dim saveFolder As String
Dim dateFormat
Dim yearFolder
dateFormat = Format(itm.ReceivedTime, "dd-mm-yyyy_hh-mm-ss-AMPM_")
yearFolder = Format(itm.ReceivedTime, "yyyy-mm")
saveFolder = "D:\TLC\STT_NL\" & yearFolder & "\"
On Error Resume Next
MkDir saveFolder
On Error GoTo 0
  For Each objAtt In itm.attachments
  Debug.Print "Found: " & objAtt.FileName & " at " & dateFormat
  If LCase(Right(objAtt.FileName, 4)) <> ".jpg" And LCase(Right(objAtt.FileName, 4)) <> ".png" Then
  Debug.Print "Confirmed as acceptable file type: " & objAtt.FileName & " at " & dateFormat
  objAtt.SaveAsFile saveFolder & dateFormat & "STT_NL" & LCase(Right(objAtt.FileName, 4))
  Debug.Print "Successful save: " & objAtt.FileName & " at " & dateFormat
  Set objAtt = Nothing
  Debug.Print "Set objAtt = Nothing"
  Debug.Print "-------------------------------------------------------------------------------------------"
  End If
  Next
End Sub
The original thread is here - [Q]Outlook VBA macros running random

This macro runs rules now: Run Rules Now using a Macro
 

soadfan

Member
Outlook version
Outlook 2013 64 bit
Email Account
Office 365 Exchange
Thanks, i'll try this
Well it fails too from time to time. So...can you help with VBA which enable all rules from a toolbar button?
I have 25+ rules and it's really annoying to re-enable disabled upon fail.

Best regards,
Peter
 
Status
Not open for further replies.
Thread starter Similar threads Forum Replies Date
Mark Foley Cannot enable add-in in outlook 2010 Using Outlook 0
Peter H Williams Enable script containing VBA Outlook VBA and Custom Forms 12
A How to enable outlook room finder (outlook connector (mapi)) user ? Using Outlook 3
Diane Poremsky Mail-enable Exchange Public Folders New Slipstick.com Articles 0
R Enable Office 365 Exchange Online Archive New Slipstick.com Articles 0
R Enable Office 365 Exchange Online Archive Using Outlook 6
G VBA code to enable a rule based on time of day for a IMAP mail account Outlook VBA and Custom Forms 14
K Macro won't consistently re-enable Outlook VBA and Custom Forms 2
Sarge USMC how do I enable hyperlinks in Outlook 2013 Using Outlook 1
A how to install or enable categories in OL 2013 for calendar and contacts Using Outlook 5
D How do I mail-enable a Public Folder Sub-folder in exchnage 2007 using shell ? Exchange Server Administration 0
H enable textboxes and buttons from received email Using Outlook 1
D How To Enable Undo in Outlook 2007 Tasks Using Outlook 2
S Outlook 2010: How do you enable Contacts' Activities to search archive folders Using Outlook 6
J OL2003 Macro disables itself - looking for way to automate 'enable' Using Outlook 2
C Enable or install Digital ID for Exchange Users on SBS 2008 Exchange Server Administration 2
M SRV records to enable auto discover for Outlook Anywhere Using Outlook 8
S vb.net exchange 2010 problem with enable-mailbox command Exchange Server Administration 2
P Exchange 2010 - Enable Spam filtering on Hub Transport Server Exchange Server Administration 3
Z Patch / hotfix enable Outlook 2007 to work with Exchange 2010 Archiving Exchange Server Administration 2
I Outlook 2007 Macro/VBE disables How to enable Using Outlook 5
C Enable EmailAddressPolicy via Exchange Shell Exchange Server Administration 2
C How to allow admins to enable ActiveSync and edit address book information in EMC Exchange Server Administration 3
W Outlook was in use; when tried to open today it would not open; pop up with info about e-mails with macros; prompted to enable macros, when doing so; Using Outlook 3
J cannot enable embedded links within received e mails, message sysy this function is disabled please contact your system administrator Using Outlook 1
G How to enable Outlook Anywhere for domain joined clients, enable Exchange ActiveSync, but disable OA Exchange Server Administration 1
M OWA (2003,2007,2010) How to enable or Disable efficiently in Bulk range Like Database/Storage Group/Server Exchange Server Administration 3
Z How to enable Content Filtering for Inbound and Outbound Emails on Exchange 2007? Exchange Server Administration 4
D OAB Offline Address Book generation server and enable web distribution on the Exchange 2010 Client Access server Exchange Server Administration 6
T How do I enable the link feature on my email account that allows me to go directly to a website from Using Outlook 1
J Can't enable Outlook anywhere in a new install of Exchange 2010 Exchange Server Administration 2
V enable a disabled e-mail account Exchange Server Administration 2
R How do I re-enable the confirmation dialog? Using Outlook 4
M Outlook 2007: How to enable my signature when starting an e-mail from MS Excel, Words and Power Point ? Using Outlook 2
S We have forgotten our password to enable Outlook while relocating to a new apartment. Our software is authentic and this PC is a 5 yr old MDG. Details Using Outlook 2
N how can i enable staff to access Exchange Server with Outlook in Exchange mode from internet ? Exchange Server Administration 2
J Enable prompt to save/open attachment Using Outlook 1
T can't enable display online status Using Outlook 4
S Mail-Enable a Public Folder in Exchange Server 2010 Exchange Server Administration 9
M Enable to access outlook 2003 even in safe mode and is giving an error message that Business Contact Manager has encountered a problem Using Outlook 2
P How to Enable Hyperlinks in Outlook 2010 Using Outlook 1
S Could not enable Outlook anywhere in Exchange 2010 Exchange Server Administration 4
E Enable Unified Messaging for a User box is Disabled in Exchange 2010 Management Console Exchange Server Administration 1
A Enable Google Apps Sync Using Outlook 3
B How to add Active Directory Permissons to Recipient Mangement Security Group to enable members to configure Send As permission in EMC Exchange Server Administration 1
J Re-enable the junk mail notification. Using Outlook 6
S How to enable macros in Outlook 2010 Using Outlook 6
M Outlook Anywhere - Enable both NTLM and Basic Authentication Exchange Server Administration 8
C How do I enable a link in an e-mail in Outlook 2007? Using Outlook 4
D how to enable ActiveX and scripting Using Outlook 2
Similar threads


















































Top