Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access posted files in Outlook public folders using Excel VBA

Status
Not open for further replies.

TvH

Programmer
Apr 4, 2001
2
GB
Hi,

I am creating a macro in Excel 97 to open Excel files (or save them somewhere else) which are posted in the Outlook 98 Public Folders. These Excel files are NOT attachments to mails though. I can get into the Public Folder and see the items posted there, but I can't open/save them (the file is not recognized as a mailitem or postitem). Does anyone know how to do this?

Thanks.
Ted
 
Just when I got really desperate I found something to open posted files:
Code:
    Set mailApp = New Outlook.Application
    Set mailNameSpace = mailApp.GetNamespace("MAPI")
    Set mailFolder = mailNameSpace.Folders("Folders1") _
                                  .Folders("Folders2") _
                                  .Folders("Folders3") _
                                  .Folders("Folders4")
                                  .Folders("FoldersEtc")
    
    For i = 1 To mailFolder.Items.Count
        If mailFolder.Items.Item(i) = "FileName.xls" Then
            mailFolder.Items.Item(i).Display
        End If
    Next
From here on you can access the file in excel and do whatever you want with it.

TvH
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top