Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Outlook macro

Posted on 2014-04-24
7
Medium Priority
?
615 Views
Last Modified: 2014-07-01
Dear Expert,

Needing help with a macro in Outlook 2010 to accomplish the following when I have highlighted a email from the email list:

1. Create a task with both email content (maintain original format) and add email attachment at beginning of task.
1.1 Include in the first part of above step the general info missing within the body of the email:
   a. The date sent details.
   b. The sender info
   c. To:, CC: info
   d. the subject.
2. Set Tast Start Date to "today"
3. Set priority to "Low"
4. Leave Task open for me to continue editing as needed.

In following expert request I will request to convert this task into its original email. Perhaps use the attached email attachment?

Best regards,
JP
0
Comment
Question by:easycapital
  • 4
  • 3
7 Comments
 

Author Comment

by:easycapital
ID: 40020220
Also please add in first step #1 above (in general the info missing within the body of the email):
a. The date sent details.
b. The sender info
c. To:, CC: info
d. the subject.
0
 
LVL 76

Accepted Solution

by:
David Lee earned 2000 total points
ID: 40020534
Hi, easycapital.  

This should do it.  I'm assuming that you know how to add macro code to Outlook.  If you don't, then let me know and I'll post instructions on how to do that.

Sub MakeTask()
    Const MACRO_NAME = "Make Task"
    Const wdPasteDefault = 0
    Const wdStory = 6
    Dim olkMsg As Object, olkD1 As Object, olkD2 As Object, olkTsk As Object, strInf As String
    Select Case TypeName(Application.ActiveWindow)
        Case "Explorer"
            Set olkMsg = Application.ActiveExplorer.Selection(1)
        Case "Inspector"
            Set olkMsg = Application.ActiveInspector.CurrentItem
    End Select
    If olkMsg.Class = olMail Then
        strInf = vbCrLf & "Received: " & olkMsg.ReceivedTime & vbCrLf
        strInf = strInf & "From: " & olkMsg.SenderName & vbCrLf
        strInf = strInf & "To: " & olkMsg.To & vbCrLf
        If olkMsg.CC <> "" Then
            strInf = strInf & "CC: " & olkMsg.CC & vbCrLf
        End If
        strInf = strInf & "Subject: " & olkMsg.Subject
        Set olkD1 = olkMsg.GetInspector.WordEditor
        olkD1.Parent.Selection.WholeStory
        olkD1.Parent.Selection.Copy
        Set olkTsk = Application.CreateItem(olTaskItem)
        olkTsk.Display
        With olkTsk
            .Body = strInf & vbCrLf & vbCrLf
            Set olkD2 = .GetInspector.WordEditor
            olkD2.Parent.Selection.EndKey wdStory
            olkD2.Parent.Selection.PasteAndFormat (wdPasteDefault)
            .Attachments.Add olkMsg, , 1
            .StartDate = Date
            .Importance = olImportanceLow
        End With
    Else
        MsgBox "Operation cancelled.  you must select an email for this macro to work.", vbCritical + vbOKOnly, MACRO_NAME
    End If
    Set olkMsg = Nothing
    Set olkD1 = Nothing
    Set olkD2 = Nothing
    Set olkTsk = Nothing
End Sub

Open in new window

0
 

Author Closing Comment

by:easycapital
ID: 40021780
Many thanks for the help.
I will open another question to address the creation of more than one macro in Outlook.
I am at basic level with Macros in Outlook.
Br,
JP
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 76

Expert Comment

by:David Lee
ID: 40022238
You're welcome!
0
 

Author Comment

by:easycapital
ID: 40153301
Dear BlueDevilFan.
Do you get messages for answered questions by any chance?

I just noticed that the above macro creates a Task only shows up under To-Do-List and I would like to have it show up under Tasks section. What should I do?
Note: I have two email accounts. I want it under the email account I receive it under,
Otherwise, could we just hard code the specific task folder where I want them to appear in?
Should I create a new question?
Br,
JP
0
 
LVL 76

Expert Comment

by:David Lee
ID: 40170438
Hi, JP.

I do.  

I'm not sure I understand.  The code creates the task in the default task folder.  Are you saying that you want the code to look at which account the source email came in through and create the task in the task folder associated with that account?
0
 

Author Comment

by:easycapital
ID: 40170624
You will notice that in the Task window there is a first section for "to do lists" - these are "mail tasks". Meaning that if you delete that type of task later, then you also erase the email. But if the task is instead created in "task" section of this window, then there is no relationship to the original plus certain time management phone apps just pick up "tasks" and not "to do list".
I opened a question under
http://mobile.experts-exchange.com/Software/Office_Productivity/Groupware/Outlook/Q_28463865.html
Thanks!
0

Featured Post

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Changing a few Outlook Options can help keep you organized!
In this article I discuss my selections of the Top Four free Outlook OST File Viewers available. Open, view and read even damaged OST files by using these tools. They all provide a clear preview of all data such as emails, notes, tasks, calendars, e…
Many of my clients call in with monstrous Gmail overloading issues with Outlook. A quick tip is to turn off the All Mail and Important folders from synching. Here is a quick video I made to show you how to turn off these and other folders in Gmail s…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

926 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question