This is my first question on StackExchange ever :-) I am Running the following script in MS Outlook VBA
Sub export()
On Error resume Next
Dim Ns As Outlook.NameSpace
Dim eitem
Dim oFile As Object
Dim fso As Object
Set Ns = Application.GetNamespace("MAPI")
Set fso = CreateObject("Scripting.FileSystemObject")
Set oFile = fso.CreateTextFile("C:\Users\chakkalakka\Desktop\mails.txt")
'Code
For Each eitem In Ns.Session.Folders.Item(12).Items
oFile.WriteLine eitem.SenderName & "§" & eitem.SentOnBehalfOfName & "§" & eitem.ReceivedTime
Next
oFile.Close
Set Ns = Nothing
Set fso = Nothing
Set oFile = Nothing
Debug.Print "Completed!"
End Sub
The script in general is working fine and the output is correct. My Problem is: I need to run this inside a folder with > 95000 items and it takes ages.
So my question is: What can I do to improve performance?
Thanks in advance for your help