简体   繁体   中英

Excel-Outlook connection through VBA

I just wanted to know, is outlook-excel connection good for tracking emails into Excel? are there any specific issues that we may come across?

Thanks all for your kind attention.

Regards, Shreekant Naik

I would recommend MS Flow to do it, as it has pre defined templates to do.

Less hassle faster set up

the easiest way is ms flow, it comes with thousands of templates you can use and it is a software from microsoft. (same as excel/outlook)

U can use VBA macros to put informations into your worksheet

    Sub Outlook-Senpai()  
        
        Dim oApp As Outlook.Application
        Dim oFolder  As Outlook.Folder
        Dim oNameSpace As Outlook.Namespace
        Dim i As Outlook.MailItem
        Dim ifilter As String
        Dim oRow As Outlook.Row
        Dim oTable As Outlook.Table
    
        Set oApp = CreateObject("Outlook.Application")
        Set oNameSpace = oApp.Session
        Set oFolder = oNameSpace.GetDefaultFolder(olFolderInbox)
    ' filter
        ifilter = "[Time] > '02/02/2022'"
        Set oTable = oFolder.GetTable(ifilter)
    ' RemoveALL
        oTable.Columns.RemoveAll
    ' Specify desired properties
        With oTable.Columns
             .Add ("EntryID")
             .Add ("Subject")
             .Add ("ReceivedTime")
             .Add ("Sender")
        End With
        
        Do Until (oTable.EndOfTable)
            Set oRow = oTable.GetNextRow()
            Debug.Print (oRow("EntryID"))
            Debug.Print (oRow("Subject"))
            Debug.Print (oRow("ReceivedTime"))
        Loop
End Sub

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM