If you would like to quickly create an Outlook note that containing all the contents of multiple Plain Text files, you can read this article. Here we will introduce a rapid method to you.
In my previous article – “2 Means to Batch Import Multiple Plain Text Files as Separate Outlook Notes“, you can learn the ways to batch import a lot of text files into Outlook as individual notes. Perhaps after reading it, you may also long for a fast way to merge and import multiple Plain Text files into a single Outlook note. Therefore, in the followings, we will make this idea come true with another piece of code.
Merge and Import Multiple Plain Text Files into a Single Outlook Note
- First off, move and store all the Plain Text files to the same Windows folder.
- Then, start your Outlook application.
- Next, trigger Outlook VBA editor with reference to “How to Run VBA Code in Your Outlook“.
- Subsequently, copy the following VBA code into a module or project.
Sub BatchImportPlainTextFilesAsSingleNote() Dim strLocalFolder As String Dim objFileSystem As Object Dim objFolder As Object Dim objFile As Object Dim strFileExtension As String Dim objTextStream As Object Dim strText As String Dim objNote As Outlook.NoteItem 'Change the path of the folder storing the source plain text files strLocalFolder = "E:\Notes" Set objFileSystem = CreateObject("scripting.FileSystemObject") Set objFolder = objFileSystem.GetFolder(strLocalFolder) Set objNote = Outlook.Application.CreateItem(olNoteItem) 'Import the text files into the new Note For Each objFile In objFolder.Files strFileExtension = objFileSystem.GetExtensionName(objFile) If strFileExtension = "txt" Then Set objTextStream = objFileSystem.OpenTextFile(objFile.Path) strText = objTextStream.ReadAll objNote.Body = objNote.Body & vbCr & "---------------------" & vbCr & vbCr & Left(objFileSystem.GetFileName(objFile), Len(objFileSystem.GetFileName(objFile)) - 4) & vbCrLf & vbCrLf & strText End If Next 'Save the Note objNote.Body = "Notes from Plain Text Files" & vbCr & vbCr & objNote.Body objNote.Save objNote.Display End Sub
- After that, press “F5” to run this macro.
- When macro completes, a new note item will be created and displayed, as shown in the following screenshot.
If Outlook PST File Is Inaccessible
Have you ever received the error message that mentioned your Outlook PST file is inaccessible? Generally speaking, it refers to that the PST file has been corrupt. Thus, under this circumstance, you have to take the following actions. In the first place, if you’ve backed up your PST file before, simply recover data from backups. Yet, if there isn’t effective backup, you can try the inbox repair tool, Scanpst, to fix the PST file. The worst case is that the internal tool also fails. At that time, your last resort would be a more experienced and trustworthy 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 mdf fix and outlook repair software products. For more information visit www.datanumen.com
Leave a Reply