Solved

Outlook 2010 Macro: add info to Company task field

Posted on 2014-10-19
3
149 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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Suggested Solutions

Following basic email etiquette rules will help you write a professional email and achieve a good, lasting impression with your contacts.
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 lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …

815 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

12 Experts available now in Live!

Get 1:1 Help Now