Forum

Extract Emails from...
 
Notifications
Clear all

Extract Emails from OST File

21 Posts
2 Users
0 Reactions
296 Views
Philip Treacy
(@philipt)
Posts: 1629
Member Admin
Topic starter
 

When try this Macro, I got same problem, pls advise how to fix Annotation-2020-06-05-082455.png

 
Posted : 08/06/2020 9:11 am
Philip Treacy
(@philipt)
Posts: 1629
Member Admin
Topic starter
 

Hi David,

What does that error say?

Have you created the reference to the Outlook library in the VBA editor?

Phil

 
Posted : 05/06/2020 8:33 pm
(@david_ng)
Posts: 310
Reputable Member
 

Error Code meaning: Missing Microsoft Outlook Object Library 16.0

 
Posted : 05/06/2020 9:20 pm
(@david_ng)
Posts: 310
Reputable Member
 

Thanks millions  Philip, will try on this.  

 
Posted : 05/06/2020 9:53 pm
(@david_ng)
Posts: 310
Reputable Member
 

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

 
Posted : 05/06/2020 10:16 pm
Philip Treacy
(@philipt)
Posts: 1629
Member Admin
Topic starter
 

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

 
Posted : 05/06/2020 10:21 pm
(@david_ng)
Posts: 310
Reputable Member
 

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

 
Posted : 05/06/2020 10:51 pm
Philip Treacy
(@philipt)
Posts: 1629
Member Admin
Topic starter
 

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

 
Posted : 05/06/2020 10:59 pm
(@david_ng)
Posts: 310
Reputable Member
 

Sorry pls refer this attach.

 
Posted : 05/06/2020 11:32 pm
(@david_ng)
Posts: 310
Reputable Member
 

Account Name : GKJ00OH004

 
Posted : 05/06/2020 11:48 pm
Philip Treacy
(@philipt)
Posts: 1629
Member Admin
Topic starter
 

Hi David,

I'll try asking again : Have you tried changing the name in the VBA code to your own email account name?

Phil

 
Posted : 06/06/2020 1:45 am
(@david_ng)
Posts: 310
Reputable Member
 

So sorry , but how to find Account name in the Outlook.ost, then update to the VBA?

 
Posted : 06/06/2020 1:56 am
Philip Treacy
(@philipt)
Posts: 1629
Member Admin
Topic starter
 

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

 
Posted : 06/06/2020 2:43 am
(@david_ng)
Posts: 310
Reputable Member
 

So sorry , where to find email account name?

As far as I know the Email account name is:  GKJ00OH004

 
Posted : 06/06/2020 4:20 am
(@david_ng)
Posts: 310
Reputable Member
 

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

 
Posted : 08/06/2020 7:48 pm
Page 1 / 2
Share: