Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Outlook 2010 Macro: add info to Company task field

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

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

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

If you don't know how to downgrade, my instructions below should be helpful.
Large Outlook files lead to various unwanted errors and corruption issues. Furthermore, large outlook files can also make Outlook take longer to start-up, search, navigate, and shut-down. So, In this article, i will discuss a method to make your Out…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

789 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