When try this Macro, I got same problem, pls advise how to fix
Hi David,
What does that error say?
Have you created the reference to the Outlook library in the VBA editor?
Phil
Error Code meaning: Missing Microsoft Outlook Object Library 16.0
Thanks millions Philip, will try on this.
I tried but the extract data seems from my old Outlook.pst Inbox Folder.
Can we run the same macro but extract from Outlook.ost file Inbox Folder; or other folder, eg Send Items Folder/ self created private folder in Outlook 365.ost
Hi David,
Yes you can. Have you changed the Email Account Name in the VBA to look at the folders for the account you are referring to?
To help any further I need to know the structure of your email folders, a screeenshot will do, and the name of the account that you want to search.
Phil
Thanks Philip, pls refer attach Screen shot of my PC
Pls help modify macro for use
BTW , my 365 Outlook.Ost kept in : D:GKJ00OH004Email….OST
Hi David,
Did you try changing the email account name in the VBA as I asked?
I also asked you to let me know the name of that account.
And that screenshot is not of Outlook 🙂
Phil
Sorry pls refer this attach.
Account Name : GKJ00OH004
Hi David,
I'll try asking again : Have you tried changing the name in the VBA code to your own email account name?
Phil
So sorry , but how to find Account name in the Outlook.ost, then update to the VBA?
Hi David,
In Reply #4 of this thread I explained how to change the VBA. Open the file I created, press ALT+F11 to open the VBA editor then make the change.
Can I just clarify something. The code I've written will read emails from an email account that is setup up inside Outlook. It will not go and read emails from inside an OST that is disconnected from Outlook.
As you've supplied a screenshot of an OST in a folder, rather than the folders of an account in Outlook, I'm suspecting that this is what you are trying to do? Please confirm.
Just to reiterate, to read info from emails, the account you are trying to read those emails from must be set up and working inside Outlook.
Phil
So sorry , where to find email account name?
As far as I know the Email account name is: GKJ00OH004
Yes.
But still not working
Dim Folder As Object
Dim Email As Variant
Dim i As Integer
Set OutlookApp = CreateObject("Outlook.Application")
Set OutlookNS = OutlookApp.GetNamespace("MAPI")
' Insert the NAME of your email account - NOT the email address
Set Folder = OutlookNS.Folders("GKJ00OH004").Folders("Inbox")
i = 1
For Each Email In Folder.Items
Range("A1").Offset(i, 0).Value = Email.SenderName
Range("B1").Offset(i, 0).Value = Email.Subject
Range("C1").Offset(i, 0).Value = Email.ReceivedTime
Range("D1").Offset(i, 0).Value = Email.To
Range("E1").Offset(i, 0).Value = Email.CC
'' Range("F1").Offset(i, 0).Value = Email.Location
i = i + 1
Next Email
Set Folder = Nothing
Set OutlookNS = Nothing
Set OutlookApp = Nothing
End Sub