on flag message event - create task

Status
Not open for further replies.

bermudamohawk

New Member
Outlook version
Outlook 2013 64 bit
Email Account
POP3
There seems to be lots of proposed solutions to this, however - all create a "to-do" list item
To-Do lists do not show in iphone Tasks (activeSynch)

Need a vba snippet to create new TASK on set flag event.

Article here appears to be the best descriptor, but this (again) only creates a to-do list item.

thx for any consideration.
 
That macro does what you want - it creates a task when you flag a message. It will show in the to-do list (all tasks do) but it's an actual task.

this says do something when the item changes (the change is setting the flag) -
Private Sub OlItems_ItemChange(ByVal Item As Object)
If Item.IsMarkedAsTask = True Then

this tells you where to create it (default task folder) - if you wanted it in a different task folder, make the change here
Set olTask = Ns.GetDefaultFolder(olFolderTasks) .Items.Add(olTaskItem)

this creates the task -
With olTask
.Subject = Item.Subject
.Attachments.Add Item
.Body = Item.Body
.DueDate = Now + 1
.Save
.Display
End With

this removes the flag (that triggered the macro).
With Item
.ClearTaskFlag
.Categories = "Task"
.Save
End With
 
groundhog day.
still showing as to-do (as you said it would) - however - tasks are empty
"trade you" email subject flag set
resulting in:
upload_2015-10-5_13-7-56.png


Tasks remain unpopulated (all containers, if any doubt)
upload_2015-10-5_13-11-45.png


The behavior exhibited is default in MSOutlook 2013, so while i'm sure the code does something (as you explained) the end result is .. really nothing.
Sorry
 
it looks like its not working at all - if it works, this line: .Display displays the task on screen so you'd know it is working.


Step through it using F8 and see what it is skipping.

is macro security set to low?
click in this macro and press the run button:
Public Sub Initialize_handler()
Set OlItems = Application.GetNamespace("MAPI"). _
GetDefaultFolder(olFolderInbox).Items
End Sub
 
added, and it cleared the runtime error
F8 just loops the Initialize_handler sub
 
Really tantalizing to see it behave properly!

Added Dim's .. essentially copied screen ver batim.
Also removed Tasks from other accounts, so there is only one.

Still Groundhog Day here.
 
If you copied the entire macro and put it into ThisOutlooksession and have macro security set to low, it should work just list it does in the video.

You might need to either click in the initilize macro and click Run or restart outlook though.
 
If you copied the entire macro and put it into ThisOutlooksession > done
and have macro security set to low > done (in Word, also - just in case)
it should work just list it does in the video. > ummm - nope

You might need to either click in the initilize macro and click Run > tried
or restart outlook though. > tried


OK, since that is a mystery as to why not .. Is it possible to create a workaround?
Copy exiting to-do into Tasks?
 
I'm not aware of any workarounds.
All of the code is purple and black? No red?

There is no 'on error resume next' to skip it if there was an error, so it looks like this isn't watching the default inbox
Public Sub Initialize_handler()
Set OlItems = Application.GetNamespace("MAPI"). _
GetDefaultFolder(olFolderInbox).Items
End Sub

Ah... that could be the problem. How many inboxes do you have an what folder do you want it to watch?
 
here's what I'm seeing:

upload_2015-10-6_13-40-3.png




I have multiple containers under Inbox (like everyone, I assume)

upload_2015-10-6_13-42-25.png



I have 5 archived psts, also. But I'm certain they wouldn't affect the code.

I could try killing them.
 
Removing the pst files would only help if one is set as the default data file.

The macro uses the default data file's inbox. This line of code needs changed if you want to use a different folder:
Set OlItems = Application.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox).Items

accounts.png
 
Keep in mind, after every change of the code the "initalize_handler" should be called, which isn't called automatically at startup. Better name it Application_Startup
 
You'd need to move the event to a class module, loop through the entire folder hierarchy and create one object of that class for every folder. Use a collection in ThisOutlookSession to store the reference on each object of your class module. Here is a sample for the loop through all folders.
 
if this is of any consequence, action would only be performed on elements in default inbox - no other containers.
Perhaps that could be on someone else's wishlist
 
You'd need to move the event to a class module, loop through the entire folder hierarchy and create one object of that class for every folder. Use a collection in ThisOutlookSession to store the reference on each object of your class module. Here is a sample for the loop through all folders.
I asked for easy. :)
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
A Flag Message for Follow Up after sending Outlook VBA and Custom Forms 1
R Call a Public Sub when a Flag is clicked on in the Message Preview pane Outlook VBA and Custom Forms 1
A automatically remove flag from original message when a response was received Using Outlook 2
M How can I customize the Follow Up Flag message in Quick Steps? Using Outlook 1
L Help: set flag for sent mail to check if received an answer Outlook VBA and Custom Forms 2
E Remove flag automatically Using Outlook 4
justicefriends How to set a flag to follow up using VBA - for addressee in TO field Outlook VBA and Custom Forms 11
T Can't reposition "Flag Status" column Using Outlook 0
R Outlook 365 update sets delete from server flag Using Outlook 1
S Change "This Week" flag start date behavior Using Outlook 1
C-S-R How to clear an Outlook (To Do) Task Flag? Using Outlook 8
A Unflag Inbox and Flag Inbox with Orange Category After Item is send Outlook VBA and Custom Forms 3
N Outlook 2010 Flag blocked for Safe Senders List???? Using Outlook 7
Rupert Dragwater Email flag does not show up in Outlook2013 Using Outlook 13
J Outlook 2013 Extract Flag Completed dates to Excel Macro Outlook VBA and Custom Forms 16
M Setting flag follow up for next business day Outlook VBA and Custom Forms 1
M VBA to change flag status in outlook contact item Outlook VBA and Custom Forms 3
A rule to flag messages not working Using Outlook 5
S set a flag task date as the next weekday Outlook VBA and Custom Forms 4
G Flag for Follow Up with a customized duetime Using Outlook 1
Diane Poremsky How to Easily Change the Private Flag Using Outlook 0
A Flag outgoing email messages in Outlook 2010 Outlook VBA and Custom Forms 0
T Customize Outlook flag Using Outlook 1
mikolajek Add on for customized flag operations? Using Outlook 4
Norbert VBA Flag that would indicate the email was sent from Outlook to Access. Outlook VBA and Custom Forms 2
A Custom Flag Form Outlook VBA and Custom Forms 2
S Have Rule or Quick Step PROMPT for custom FLAG Due/Reminder date Outlook VBA and Custom Forms 3
mikecox Missing alarm flag Using Outlook 2
smokiibear follow-up flag fro Tasks in Outlook 2010 Using Outlook 5
D Create additional custom flag descriptions (other than Send E-Mail, Call etc.) Using Outlook 1
L VBA Macro to flag sent emails Using Outlook 1
A Post Form Follow Up Flag Using Outlook 4
S Flag Completion Using Outlook 0
J How to set a flag to follow up using VBA for outlook 2003 Using Outlook 10
F Apply Follow up flag ONLY to the people cc'd. Using Outlook 1
J Macro to periodically sort emails by flag status? Using Outlook 1
2 Flag for Follow up or create new task Using Outlook 1
L Flag settings Using Outlook 1
D Setting the Reminder flag in VBA for e-Mails sent to users Outlook VBA and Custom Forms 5
S Adding follow flag for me by macro (MSO2007) Outlook VBA and Custom Forms 3
H Outlook 2016 Custom made "Message" column Outlook VBA and Custom Forms 4
Terry Sullivan Unwanted Duplicate E-Mails -- One with My Message and the Other Blank Using Outlook 0
M Outlook 365 adding standard message in body of template email Outlook VBA and Custom Forms 3
E "The operation cannot be performed because the message has been changed" Using Outlook 3
G Reply a selected message and remove blank space before signature Outlook 365 version 2406 64BIT Outlook VBA and Custom Forms 2
G Reply a selected message and remove blank space before signature Outlook 365 version 2406 64BIT Outlook VBA and Custom Forms 0
D Outlook 365 Outlook Message "Cannot be sent because the message has changed" Using Outlook 0
B Please remind me how I added this message button Outlook VBA and Custom Forms 0
E PgUp and PgDn don't work for displayed message content (but do for web pages) Using Outlook 4
M A plug in (or method) to keep email message formatting after it expires Using Outlook 1

Similar threads

Back
Top