Office Solutions Archive

When checking all the tasks linked or assigned to a specific contact, you may want to print them as well. Now, in this article, we will share you a method to batch print such tasks.

To check the tasks linked or assigned to a contact, you can open this contact and access its “Activities” page, in which all such tasks are gathered here. But, if you’d like to print these tasks, you need to open them and then print one by one. Thus, obviously, it is a bit troublesome. Now, in the followings, we will introduce a way to batch print these tasks.

Contact Activities

Batch Print All Tasks Linked or Assigned to a Specific Contact

  1. At the very outset, select a contact that you want.
  2. Then, access Outlook VBA editor by referring to “How to Run VBA Code in Your Outlook“.
  3. Next, copy the following VBA code into a module.
Dim objContact As ContactItem

Sub PrintTasksLinkedOrAssignedToSpecificContact()
    Dim objStore As Outlook.Store
    Dim objOutlookFile As Outlook.Folder
    Dim objFolder As Outlook.Folder
 
    'Get the selected contact
    Set objContact = Outlook.Application.ActiveExplorer.Selection.Item(1)
 
    For Each objStore In Application.Session.Stores
        Set objOutlookFile = objStore.GetRootFolder
        For Each objFolder In objOutlookFile.Folders
            If objFolder.DefaultItemType = olTaskItem Then
               Call ProcessFolders(objFolder)
            End If
        Next
    Next
End Sub

Sub ProcessFolders(ByVal objCurFolder As Outlook.Folder)
    Dim objTask As Outlook.TaskItem
    Dim objSubfolder As Outlook.Folder
 
    For Each objTask In objCurFolder.Items
        'Print linked tasks to the contact
        If objTask.Links.Count > 0 Then
           i = 0
           Do Until i = objTask.Links.Count
              i = i + 1
              If objTask.Links(i).Name = objContact.FullName Then
                 objTask.PrintOut
                 Exit Do
              End If
           Loop
         'Print assigned tasks to the contact
         ElseIf (objTask.Owner = objContact.FullName) Or (objTask.Owner = objContact.Email1DisplayName) Or (objTask.Owner = objContact.Email1Address) Or (objTask.Owner = objContact.Email2DisplayName) Or (objTask.Owner = objContact.Email2Address) Or (objTask.Owner = objContact.Email3DisplayName) Or (objTask.Owner = objContact.Email3Address) Then
           objTask.PrintOut
         End If
    Next
 
    If objCurFolder.Folders.Count > 0 Then
       For Each objSubfolder In objCurFolder.Folders
           Call ProcessFolders(objSubfolder)
       Next
    End If
End Sub

VBA Code - Batch Print All Tasks Linked or Assigned to a Specific Contact

  1. After that, click into the first subroutine.
  2. Later, click “Run” icon in toolbar to run this macro right now.
  3. When macro finishes, all the tasks linked or assigned to the selected contact will be printed out, as shown in the following screenshot.Printed Tasks

Prevent Outlook Data Loss

When it comes to avoiding data loss, undoubtedly, regular data backups must be the first and foremost measure. The same holds true for Outlook data. That is to say, if you are not ready to lose your Outlook data, you have to make Outlook data backups on a regular basis. Besides, in order to get immediate rescue in the event of Outlook corruption, you are better off keeping a potent and credible PST repair tool, like DataNumen Outlook Repair, which is well-versed in recovering corrupt Outlook file.

Author Introduction:

Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including sql corruption and outlook repair software products. For more information visit www.datanumen.com

Be the first to comment

If you need to extract all the contacts’ phone numbers and print them in list, you can use the method introduced in this article. It can let you achieve this in one go.

Perhaps you have input phone numbers to all contacts in your Outlook. Then, you may wish to create and print a phone book from Outlook. That refers to getting the list of all contacts’ phone numbers and printing this list. Now, thereinafter, we will introduce a quick method. It can save you from manually extracting contacts’ phone numbers one by one.

Quickly Print a List of All Contacts’ Phone Numbers

  1. First off, trigger Outlook VBA editor according to “How to Run VBA Code in Your Outlook“.
  2. Then, in the new window, activate the reference to “MS Excel Object Library” by reading “How to Add an Object Library Reference in VBA“.
  3. Next, put the following VBA code into a module.
Dim objExcelApp As Excel.Application
Dim objExcelWorkbook As Excel.Workbook
Dim objExcelWorksheet As Excel.Worksheet

Sub PrintListPhoneNumbers()
    Dim objStore As Outlook.Store
 
    Set objExcelApp = CreateObject("Excel.Application")
    Set objExcelWorkbook = objExcelApp.Workbooks.Add
    Set objExcelWorksheet = objExcelWorkbook.Sheets(1)
    objExcelApp.Visible = True
 
    With objExcelWorksheet
         .Cells(1, 1) = "Contact"
         .Cells(1, 1).Font.Bold = True
         .Cells(1, 2) = "Business"
         .Cells(1, 2).Font.Bold = True
         .Cells(1, 3) = "Home"
         .Cells(1, 3).Font.Bold = True
         .Cells(1, 4) = "Other"
         .Cells(1, 4).Font.Bold = True
    End With
 
    For Each objStore In Application.Session.Stores
        Call ProcessFolders(objStore.GetRootFolder.Folders)
    Next
 
    objExcelWorksheet.Columns("A:D").AutoFit
    objExcelWorksheet.PrintOut
    objExcelWorkbook.Close False
    objExcelApp.Quit
End Sub

Sub ProcessFolders(ByVal objFolders As Outlook.Folders)
    Dim objFolder As Outlook.Folder
    Dim i As Long
    Dim objContact As Outlook.ContactItem
    Dim nLastRow As Integer
    Dim objSubfolder As Outlook.Folder
 
    For Each objFolder In objFolders
        If objFolder.DefaultItemType = olContactItem Then
           For i = objFolder.Items.Count To 1 Step -1
               If objFolder.Items(i).Class = olContact Then
                  Set objContact = objFolder.Items(i)
 
                  If objContact.BusinessTelephoneNumber <> "" Or objContact.HomeTelephoneNumber <> "" Or objContact.OtherTelephoneNumber <> "" Then
                     nLastRow = objExcelWorksheet.Range("A" & objExcelWorksheet.Rows.Count).End(xlUp).Row + 1
 
                     With objExcelWorksheet
                          .Range("A" & nLastRow) = objContact.FullName
                          .Range("B" & nLastRow) = objContact.BusinessTelephoneNumber
                          .Range("C" & nLastRow) = objContact.HomeTelephoneNumber
                          .Range("D" & nLastRow) = objContact.OtherTelephoneNumber
                     End With
                  End If
              End If
           Next
 
          If objFolder.Folders.Count > 0 Then
             Call ProcessFolders(objFolder.Folders)
          End If
       End If
    Next
End Sub

VBA Code - Quickly Print a List of All Contacts' Phone Numbers

  1. After that, click into the first subroutine and press “F5” key button.
  2. At once, a list of all your contacts’ phone numbers will be printed, as shown in the following screenshot.Printed List of All Contacts' Phone Numbers

Take Care of Your Outlook Well

As we all know, it is a bit hard to predicate and evade Outlook errors. Therefore, what we can do is to make some precautions in advance. Simply put, you ought to make data backups for Outlook periodically. Plus, you should look out for all the hidden viruses or malware in emails. Last but not least, you had better get hold of a powerful and reliable Outlook fix tool, like DataNumen Outlook Repair. It is able to repair Outlook file in a jiffy.

Author Introduction:

Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including recover mdf and outlook repair software products. For more information visit www.datanumen.com

Be the first to comment

This article will share you a method to prevent the new contact group from having the same name as any existing groups.

If there are some contact groups that have the same name in your Contacts folder, you may frequently mix them up. For instance, in this situation, when you need to send an email to a contact group, you will find a bit troublesome to find the right group. To avoid this problem, you have to ensure that new contact group has the different name as any existing groups. Now, in the followings, we will introduce a method which can configure Outlook to auto warn you if the new group has the same name as an existing one.

Get Confirmed before Saving a Contact Group with an Existing Name

  1. For a start, launch Outlook VBA editor by referring to “How to Run VBA Code in Your Outlook“.
  2. Then, copy and paste the following VBA code into the “ThisOutlookSession” project.
Public WithEvents objInspectors As Outlook.Inspectors
Public WithEvents objContactGroup As Outlook.DistListItem

Private Sub Application_Startup()
    Set objInspectors = Outlook.Application.Inspectors
End Sub

Private Sub objInspectors_NewInspector(ByVal Inspector As Inspector)
    If TypeOf Inspector.CurrentItem Is DistListItem Then
       Set objContactGroup = Inspector.CurrentItem
    End If
End Sub

'before saving the contact group
Private Sub objContactGroup_Write(Cancel As Boolean)
    Dim strGroupName As String
    Dim objContactsFolder As Outlook.Folder
 
    strGroupName = LCase(objContactGroup.Subject)
 
    Set objContactsFolder = objContactGroup.Parent
    For Each objItem In objContactsFolder.Items
        If TypeOf objItem Is DistListItem Then
           'If the new group's name is same as an existing one
           If LCase(objItem.Subject) = strGroupName Then
              'Get confirmed
              strMsg = "There has been an existing group having the same name!" & vbCrLf & "Do you want to save it?"
             If MsgBox(strMsg, vbExclamation + vbYesNo) = vbYes Then
                Cancel = False
             Else
                Cancel = True
             End If
             Exit For
           End If
       End If
    Next
End Sub

VBA Code - Get Confirmed before Saving a Contact Group with an Existing Name

  1. After that, click into the “Application_Startup” subroutine and press “F5” key.
  2. Finally, you can have a try.
  • First off, create a new contact group.
  • Then, enter a name which is same as an existing group’s name.
  • Later, try to save it by clicking “Save & Close” button.Save New Contact Group
  • At once, you’ll get a message, like the following screenshot.Popup Confirmation
  • If you select “No”, the contact group will not be saved and will keep open for you to change name.
  • If you select “Yes”, the group will be saved immediately.

Abstain Outlook Data Loss

Numerous Outlook users have been plagued by PST data losses. Generally, in face of Outlook corruption, you need to firstly check if there’s an updated data backup available. If not, you can proceed to attempt to fix PST file by the inbox repair tool. At the worst, assuming that Scanpst fails, you have no alternative to invest in an experienced and creditworthy external utility, like DataNumen Outlook Repair.

Author Introduction:

Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including recover Sql Server and outlook repair software products. For more information visit www.datanumen.com

Be the first to comment