Outlook Solutions Archive

When flagging a contact, some users hope to get a standard Outlook task in To-Do List instead of a flagged contact. Now, in this article, we will introduce a method to let Outlook auto create a task for call the contact person later when flagging a contact.

As we all know, when flagging a contact, the contact will display in the To-Do list. But, most of time, what we really want is a standard task for calling this contact later and contains the telephone numbers of the contact only in task body. Hence, here we will introduce a method to configure Outlook to auto create such a task. Read on to get more details.

Auto Create a Task to Call the Contact Person Later when Flagging a Contact

  1. At first, launch Outlook VBA editor with reference to “How to Run VBA Code in Your Outlook“.
  2. Then, open the “ThisOutlookSession” project and put the following code into it.
Private WithEvents objContacts As Outlook.Items

'Works for contacts in the default Contact folder
Private Sub Application_Startup()
    Set objContacts = Outlook.Application.Session.GetDefaultFolder(olFolderContacts).Items
End Sub

Private Sub objContacts_ItemChange(ByVal Item As Object)
    Dim objContact As Outlook.ContactItem
    Dim objTask As Outlook.TaskItem

    If TypeOf Item Is ContactItem Then
       Set objContact = Item

       If objContact.IsMarkedAsTask = True Then
          If objContact.TaskCompletedDate = "1/1/4501" Then
             'Create a task for calling this contact
             Set objTask = Outlook.Application.CreateItem(olTaskItem)
             With objTask
                  .Subject = "Call " & objContact.FullName
                  .StartDate = objContact.TaskStartDate
                  .DueDate = objContact.TaskDueDate
                  .Attachments.Add objContact
                  .Body = "Business: " & objContact.BusinessTelephoneNumber & vbCr & "Home: " & objContact.HomeTelephoneNumber & vbCr & "Other: " & objContact.OtherTelephoneNumber & vbCr & vbCr
                  .ReminderSet = True
                  .ReminderTime = objContact.ReminderTime
                  .Save
                  .Display
             End With
             objContact.ClearTaskFlag
             objContact.Save
        End If
      End If
   End If
End Sub

VBA Code - Auto Create a Task to Call the Contact Person Later when Flagging a Contact

  1. After that, put cursor in the “Application_Startup” subroutine and press “F5” key to activate this macro.
  2. Finally, exit the VBA editor and try this macro right away.
  • Select or open a contact and flag it.Flag a Contact
  • At once, a new task will be displayed, like the following screenshot.Popup Task
  • Meanwhile, as you can see, the contact’s flag is automatically removed.

Repair Compromised PST Files

Like Word documents, Outlook PST file is also prone to corruption. Many users have been plagued by the problems related to inaccessible PST files. Fortunately, Outlook comes pre-installed with an inbuilt repair utility – Scanpst. It is indeed able to fix a majority of small PST issues. Yet, when confronting seriously corrupt PST file, it seems ineffective. Thereby, at that time, you have to take aid of a more powerful tool, 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 sql recovery and outlook repair software products. For more information visit www.datanumen.com

It is easy to attach a Word document as a PDF file to an Outlook email. Yet, if you’d like to attach multiple Word documents as PDF files to an email, you can read this article. Here we will show you a method to batch get it.

To attach a Word document as PDF file to an Outlook email, you can firstly open the Word document and go to “File” menu. Then, you can switch to “Save & Send” tab, on which there is a “Send as PDF” button, like the following screenshot.

Send as PDF

Thus, it is quite simple to attach a Word document as PDF to an email. But, if you would like to convert and attach multiple Word documents as PDF files to a mail, you are better off using the following way. It can let you accomplish it in bulk.

Batch Convert & Attach Multiple Word Documents as PDF Files to an Email

  1. For a start, gather the Word documents that you want in the same Windows folder.
  2. Then, launch Outlook program.
  3. Next, copy the following code into an unused project or module.
Dim objMail As Outlook.MailItem

Sub BatchAttachMultipleWordDocumentsAsPDFToEmail()
    Dim objShell As Object
    Dim objWindowsFolder As Object
    Dim strWindowsFolder As String

    Set objMail = Outlook.Application.CreateItem(olMailItem)

    'Select the specific Windows folder
    Set objShell = CreateObject("Shell.Application")
    Set objWindowsFolder = objShell.BrowseForFolder(0, "Select a Windows folder:", 0, "")

    If Not objWindowsFolder Is Nothing Then
       strWindowsFolder = objWindowsFolder.self.Path & "\"

       Call ProcessFolders(strWindowsFolder)

       objMail.Display
    End If
End Sub

Sub ProcessFolders(strPath As String)
    Dim objFileSystem As Object
    Dim objFolder As Object
    Dim objFile As Object
    Dim objWordApp As Word.Application
    Dim objWordDocument As Word.Document
    Dim strDocumentName As String
    Dim strPDF As String

    Set objFileSystem = CreateObject("Scripting.FileSystemObject")
    Set objFolder = objFileSystem.GetFolder(strPath)

    For Each objFile In objFolder.Files
        strFileExtension = objFileSystem.GetExtensionName(objFile)
        If LCase(strFileExtension) = "doc" Or LCase(strFileExtension) = "docx" Then
           Set objWordApp = CreateObject("Word.Application")
           Set objWordDocument = objWordApp.Documents.Open(objFile.Path)

           'Convert document to pdf
           strDocumentName = Left(objWordDocument.Name, (Len(objWordDocument.Name) - Len(strFileExtension)) - 1)
           strPDF = strPath & strDocumentName & ".pdf"
           objWordDocument.ExportAsFixedFormat strPDF, wdExportFormatPDF

           objWordDocument.Close False

           'Attach the pdf to email
           objMail.Attachments.Add strPDF

           Kill strPDF
        End If
    Next

    'Process all folders and subfolders
    If objFolder.SubFolders.Count > 0 Then
       For Each objSubfolder In objFolder.SubFolders
           If ((objSubfolder.Attributes And 2) = 0) And ((objSubfolder.Attributes And 4) = 0) Then
              ProcessFolders (objSubfolder.Path)
           End If
       Next
    End If
End Sub

VBA Code - Batch Convert & Attach Multiple Word Documents as PDF Files to an Email

  1. After that, move cursor into the first subroutine.
  2. Subsequently, press “F5” to run this macro right away.
  3. In the popup small dialog box, select the Windows folder where the source Word documents are stored.Select Windows Folder
  4. At once, a new email will be created, in which you can see the attached PDF files, like the following screenshost.Attached PDF Files in New Email

Plagued by Outlook Troubles

Are you disturbed by miscellaneous Outlook problems? For instance, Outlook is frequent stuck in “not responding” state or Outlook PST file becomes inaccessible, etc. In general, you can first try inbox repair tool, Scanpst, to fix PST issues. Yet, at times, the problems may be beyond what the inbuilt tool can do. Therefore, you’d better keep a more potent external utility in vicinity, such as 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 sql repair and outlook repair software products. For more information visit www.datanumen.com

If an Outlook task contains many attachments, to extract and save them to a local folder, in general, you have to save them one by one manually. Yet, in this article, we will introduce a method to batch save all attachments in one go.

At times, you may receive a task assigned from someone else. And this task may contain several important attachments in its body. In face of such a task, you may need to extract and save these attachments to a Windows folder. Yet, unlike email, you cannot save them in batches by default. Outlook only allows you to save one by one. Obviously, it will be too tedious if there are too many attachments. Hence, here we will introduce a way to let you accomplish this task in bulk.

Batch Save All Attachments in a Task to a Windows Folder

  1. At the very outset, launch Outlook application.
  2. Then, trigger Outlook VBA editor with reference to “How to Run VBA Code in Your Outlook“.
  3. Next, copy the following code into an unused module.
Sub BatchSaveAttachmentsFromTask()
    Dim objTask As Outlook.TaskItem
    Dim objShell, objWindowsFolder As Object
    Dim strWindowsFolder As String
    Dim objAttachment As Outlook.Attachment
    Dim strFolder, strFilePath As String

    'Get the task
    Select Case Outlook.Application.ActiveWindow.Class
           Case olInspector
                Set objTask = ActiveInspector.CurrentItem
           Case olExplorer
                Set objTask = ActiveExplorer.Selection.Item(1)
    End Select

    'Select a Windows folder for saving extracted attachments
    Set objShell = CreateObject("Shell.Application")
    Set objWindowsFolder = objShell.BrowseForFolder(0, "Select a folder to save Tasks' attachments:", 0, "")

    If Not objWindowsFolder Is Nothing Then
       strWindowsFolder = objWindowsFolder.self.Path & "\"

       If objTask.Attachments.Count > 0 Then

          For Each objAttachment In objTask.Attachments
              strFilePath = strWindowsFolder & objAttachment.FileName
              objAttachment.SaveAsFile strFilePath
          Next
       End If

       Shell "Explorer.exe" & " " & strWindowsFolder, vbNormalFocus
    End If
End Sub

VBA Code - Batch Save All Attachments in a Task to a Windows Folder

  1. Subsequently, exit the VBA editor.
  2. After that, add this macro to Quick Access Toolbar or ribbon.
  3. Eventually, you can have a try.
  • First off, select or open a task.
  • Then, click the newly added macro button.Run Macro on Task
  • In the popup dialog box, select a Windows folder as per your needs.
  • Afterwards, click “OK”.Select Windows Folder
  • At once, the Windows folder will be displayed, in which you can find the extracted attachments.Saved Attachments

Cope with Disturbing Outlook Issues

As we all know, Outlook PST file is susceptible to various errors and corruption. For instance, if you frequently close your Outlook improperly or you download any malicious files, your Outlook PST file may become inaccessible one day. At that time, even the inbox repair tool is unable to help you. What you can resort to is more experienced and trustworthy PST fix software, like DataNumen Outlook Repair. It can extract maximum Outlook data from a PST file in quick time.

Author Introduction:

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