Works with Outlook 2002 but not 2003

PortyAL

Craigavon, N.Ireland
Local time
Today, 13:16
Joined
Apr 16, 2007
Messages
24
Hi

I have a machine running Outlook 2002 and Access 2002. The code below searches a subfolder in my inbox called "Temp", finds any messages flagged as "complete", displays the emails and saves them as HTML files to a folder as specified in the field "docfolder" in the open Access form "form1".

The Access project has Microsoft Outlook 10.0 Object Library installed.

The code works perfectly, but problems have arisen when I tried to use it on a machine with Outlook 2003 installed. The Access version is still 2002 but the project has Microsoft Outlook 11.0 Library installed rather than 10.0.

I get an "Object doesn't support this property or method" error on the line If temp.Items.Item(i).FlagStatus = olFlagComplete Then below.

Any help would be greatly appreciated.

Code:
Sub Analyze_Email()
   Dim ns As Outlook.NameSpace
   Dim sent As Outlook.MAPIFolder
   Dim temp As Outlook.MAPIFolder
   Dim i As Integer

   
   Set ns = GetNamespace("MAPI")
 
   ' Temp is a subfolder of Inbox
   Set temp = ns.GetDefaultFolder(olFolderInbox).Folders("Temp")
   
   For i = temp.Items.Count To 1 Step -1
   If temp.Items.Item(i).FlagStatus = olFlagComplete Then
        temp.Items.Item(i).Display
        temp.Items.Item(i).SaveAs forms!form1!docfolder & "\" & temp.Items.Item(i).Subject & ".htm", olHTML
        
      End If
   Next
   
     
   Set temp = Nothing
   Set ns = Nothing
End Sub

Thanks in advance

AL
 

Users who are viewing this thread

Back
Top Bottom