I have created a macro to read Outlook emails and extract values and headers (subject time sent etc.) to Excel.
This was working before but now prompts an error "The attempted operation failed. An object could not be found".
The location of the folder is "Inbox/TIBCO Reports Folder". The error is prompting at line
Set olFolder = olFolder.Folders(1).Folders("Inbox").Folders("TIBCO Reports Folder")
Here is the part of the code:
Dim olApp As Object
Dim olFolder As Object
Dim olMailItem As Object
Dim strTo As String
Dim strFrom As String
Dim dateSent As Variant
Dim dateReceived As Variant
Dim strSubject As String
Dim strBody As String
Dim date1 As Date
Dim date2 As Date
Dim loopControl As Variant
Dim mailCount As Long
Dim totalItems As Long
'-------------------------------------------------------------
'//Turn off screen updating
Application.ScreenUpdating = False
'//Clearing worksheet content
'Sheets("OutlookEmail").Cells.Clear
'//Setup headers for information
Sheets("OutlookEmail").Select
Range("A1:F1").Value = Array("Subject", "From", "Date/Time Sent", "Date/Time Received", "To", "Attachment")
'//Format columns E and F to
Columns("C:D").EntireColumn.NumberFormat = "MM/DD/YYYY HH:MM:SS"
'//Create instance of Outlook
Set olApp = CreateObject("Outlook.Application")
'//Select folder to extract mail from
Set olFolder = olApp.GetNamespace("MAPI")
Set olFolder = olFolder.Folders(1).Folders("Inbox").Folders("TIBCO Reports Folder")