Solved

Outlook 2010 Macro: add info to Company task field

Posted on 2014-10-19
3
143 Views
Last Modified: 2014-10-22
Dear expert,

Be able to highlight/select several tasks and have an input cell pop up for Company field and in next step this Company field replaces all the info which may have existed in the Company field of the selected tasks.

Br,
JP
0
Comment
Question by:easycapital
3 Comments
 
LVL 49

Assisted Solution

by:Rgonzo1971
Rgonzo1971 earned 250 total points
ID: 40391604
Hi,

pls try
sub Macro()
strCompany = InputBox("New Company", "Select the new Company name")
For Each itmTsk In Application.ActiveExplorer.Selection.Items  
    itmTask.Company = strCompany
Next
End Sub

Open in new window

Regards
0
 
LVL 20

Accepted Solution

by:
ltlbearand3 earned 250 total points
ID: 40393513
I don't know about the objects in older versions of outlook as I don't have a copy to test, but here are some adaptations to Rgonzo's code that will work in Office 2010 and newer.

Sub UpdateCompany()
    Dim strCompany As String
    Dim objTask As Outlook.TaskItem
    Dim i As Integer

    strCompany = InputBox("New Company", "Select the new Company name")

    For i = 1 To Outlook.ActiveExplorer.Selection.Count
        Set objTask = Outlook.ActiveExplorer.Selection.Item(i)
        objTask.Companies = strCompany
        objTask.Save
    Next
    
    MsgBox Outlook.ActiveExplorer.Selection.Count & " task(s) have been update to a new company of " & strCompany
    
End Sub
       

Open in new window

0
 

Author Closing Comment

by:easycapital
ID: 40398622
Excellent!

I went with 2nd solution.

Br,
Juan
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Resolve Outlook connectivity issues after moving mailbox to new Exchange 2016 server
This article lists the top 5 free OST to PST Converter Tools. These tools save a lot of time for users when they want to convert OST to PST after their exchange server is no longer available or some other critical issue with exchange server or impor…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
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…

867 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now