Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1565
  • Last Modified:

Run Outlook 2007 rules from a button on the toolbar

I am using Outlook 2007 with all updates. I have 2 rules to move certain messages into the proper folders. I have the rules turned off because I do not want this rule to run automatically. I'll take it with 1 button for each rule if thats the only way but I'll double the points if there is a way to click 1 button on the toolbar to run just those 2 rules. I have other rules that I do not want it to run with these 2. Thanks in advance!

Jon
0
Jon DeVito
Asked:
Jon DeVito
  • 5
  • 3
  • 2
1 Solution
 
Jon DeVitoAuthor Commented:
Thanks a lot but I don't really see a solution in there for what I'm looking to do. I need a step by step solution for this as I'm not very good with scripting.
0
 
weellioCommented:
rather than running your rules, you can use this to edit to create a rule via vba to do what you want to do,.

do you know how to make a button?

On the Tools menu, point to Macro, and click Visual Basic Editor.
In the Project - Project1 pane, right-click Project1, and insert- module
and paste the following text


Sub DoStuff()
' Declare variables
    Dim ns As NameSpace
    Dim Inbox As MAPIFolder
    Dim Item As Object
    Dim Atmt As Attachment
    Dim File As String
    Dim i As Integer
    Set ns = GetNamespace("MAPI")
    Set Inbox = ns.GetDefaultFolder(olFolderInbox)
    Set myfolder = Inbox.Folders("my folder") 'if you want to search a subfolder of inbox
      Set myDestFolder = myInbox.Folders("Personal Mail") 'the name of the folder you want to move it to
    i = 0
' Check Inbox for messages and exit of none found
    If myfolder.Items.Count = 0 Then
        MsgBox "There are no messages in the Inbox.", vbInformation, _
               "Nothing Found"
        Exit Sub
    End If
' Check each message for attachments
    For Each Item In myfolder.Items 'change to inbox.items to look in inbox
        strresult = strresult & Item & vbCrLf 'item = subject
        If Item = "A Particular subject" Then 'searches for this subject
           Item.Move myDestFolder 'this moves the file
        Else
        End If
    Next Item
    MsgBox strresult 'if you want to see a popup of the names of the attachments
    End Sub

0
Microsoft Certification Exam 74-409

VeeamĀ® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
weellioCommented:
view - toolbars-customize
in the toobars tab choose new and name your toolbar
now from your commands tab find macros
drag the dostuff macro to your new toolbar
then rightclick on it and you can customize the way it looks (change the name, assign an icon, etc)
0
 
Jon DeVitoAuthor Commented:
Hey Weellio sorry for the late posting. Switched jobs & lost access to the account for a while. This solution works great but it only downloads the first picture. If there are more than one picture on the page it wont work. Any ideas? Thanks & sorry again!
0
 
weellioCommented:
downloads a picture?
this is about moving messages is it not?
0
 
Jon DeVitoAuthor Commented:
Sorry, wrong posting =)
0
 
ApexadamCommented:
Weelio,
I lurked on this post because I am struggling with the reason why my Outlook 2007 rules are not automatically applied.  Even when I use the Tools/Rules and Alerts/Run Rules Now, it forces me to re-check every rule box before applying.  I have over 100 rules, 1 rule for every incoming email domain.  Am I doing something wrong?  Shouldn't the rule application be automatic.  Instead, when it doesn't process, I create a new rule which ends up with (2) or (5) because of the number of times I've created it...I thought you might be able to give some assistance prior to throwing the question out to the general population...
apexadam
0
 
weellioCommented:
create  a new post.
i've never used outlook 2007.
it probably would be easier to create some sort of script to autofilter your emails by domain. then again, this depends on what you're doing with them. if it is as simple as moving them to folders that match the domain, then any number of experts here could assist with the code.
0
 
ApexadamCommented:
weelio,
Thanks for the reply.  I will dig around and ask the question in the appropriate forum...
Take care!
0

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

  • 5
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now