troubleshooting Question

Excel VBA: Convert from Early Binding to Late Binding

Avatar of Dale James
Dale James asked on
OutlookVBAMicrosoft ExcelMicrosoft Office
5 Comments1 Solution14 ViewsLast Modified:
Hello Team,

I have inherited the follow code which is used to record the details contained within each email received into the Plan Setup mailbox.

The code is currently coded for early binding but can you please advise where and what equivalent code should be used to convert to late binding?

Sub PlanSetup()


Dim OutApp As Outlook.Application
Dim OutlookNamespace As Namespace
Dim Folder As MAPIFolder
Dim OutlookMail As Variant
Dim i As Integer
Dim OutApp As Outlook.Application
Dim FlagCol As String
Dim fldSpamDigest As Outlook.MAPIFolder
   
Set OutlookApp = New Outlook.Application
Set OutlookNamespace = OutlookApp.GetNamespace("MAPI"


Set Folder = OutApp.GetNamespace("MAPI").Folders("Plansetup").Folders("Inbox") '.Folders("1 Plan Setup Enquiries")




Sheets(1).Select


i = 1


For Each OutlookMail In Folder.Items
   
Range("A1").Offset(i, 0).Value = OutlookMail.Subject
       
       
       
        If InStr(1, OutlookMail.Subject, "Recall") > 0 Or InStr(1,    OutlookMail.Subject, "Undeliver") > 0 Or InStr(1,             OutlookMail.Subject, "delay") > 0 Then
       


       
        Range("B1").Offset(i, 0).Value = "=Today()"
        Range("C1").Offset(i, 0).Value = "Recall"
        Range("D1").Offset(i, 0).Value = OutlookMail.UnRead
        Range("E1").Offset(i, 0).Value = 0
 
       
    Else
       
        Range("B1").Offset(i, 0).Value = OutlookMail.ReceivedTime
        Range("C1").Offset(i, 0).Value = OutlookMail.SenderName
        Range("D1").Offset(i, 0).Value = OutlookMail.UnRead
        Range("E1").Offset(i, 0).Value = OutlookMail.FlagStatus
    
    End If
       
    i = i + 1
    Next OutlookMail


Set Folder = Nothing
Set OutlookNamespace = Nothing
Set OutlookApp = Nothing




End Sub

Open in new window


Thank you in advance.

Sincerely

Dale

ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros