Need to Add Outlook Object Library

MUKESHY12390

Well-known Member
Joined
Sep 18, 2012
Messages
846
Hi frnds,

I have created macro that extract and save attachment from Outlook in particular folder.
And thats works perfectly but whenever I use same macro in MS office 2010 through missing reference error , then I need to add outlook 14.0 reference everytime used in 2010.Currently I am using 2007

Is there any way to overcame this problem.
Code:
 Dim myOlapp As Outlook.Application
    Dim myNameSpace As Outlook.Namespace
    Dim myFolder As Outlook.MAPIFolder
    Dim myItem As Outlook.MailItem
    Dim myAttachment As Outlook.Attachment
    Dim i As Long
    Dim dpath As String
   
    
    dpath = ThisWorkbook.Sheets("Macro").Range("C9")
    LP = ThisWorkbook.Sheets("Macro").Range("B9")
    Set myOlapp = CreateObject("Outlook.Application")
    Set myNameSpace = myOlapp.GetNamespace("MAPI")
    Set myFolder = myNameSpace.GetDefaultFolder(olFolderInbox)
    Set myFolder = myFolder.Folders(LP) ''' getting error here
Thats not whole macro, because that would be little confusing.

Any small suggetion will be appreciated

Thanks in Advance.
 

Some videos you may like

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.

Watch MrExcel Video

Forum statistics

Threads
1,095,806
Messages
5,446,575
Members
405,409
Latest member
croc23

This Week's Hot Topics

Top