Ok the code is actually from Access...
The line that is causing the problem is the attempt to GetObject if outlook is not open then this will cause a problem.
If the code is inside Outlook you should be able to drop the outlook part of it... like so
VB Code:
Dim myOlExp As Explorers Dim obSi As Selection Dim obMi As MailItem Set myOlExp = Application.Explorers Set obSi = myOlExp.Item(1).Selection For i = 1 To obSi.Count Set obMi = obSi.Item(i) Debug.Print obMi.SenderName Debug.Print obMi.Subject Next i Set obMi = Nothing Set obSi = Nothing Set myOlExp = Nothing
In my corporation VBA is disabled behind Outlook so I cannot test to see if this will actually work




Reply With Quote