Outlook 2000 Automation Error on Windows 98

S

Song Huang

HI,

I have this problem and I can't find any tips from web sites.

I am using VB6 & Outlook 2000 & MDAC 2.6

The following is the codes:

Dim oOutlook As Outlook.Application
Dim oNs As Outlook.NameSpace
Dim oFldr As Outlook.MAPIFolder
Dim oItem As Outlook.MailItem

On Error GoTo ErrorHandler

Set oOutlook = New Outlook.Application
Set oNs = oOutlook.GetNamespace("MAPI")
oNs.Logon
Set oFldr = oNs.GetDefaultFolder(olFolderInbox)

Dim k As Integer
Dim i As Integer

k = oFldr.Items.Count
MsgBox "Items: " & k

For i = 1 To k

Set oItem = oFldr.Items(i)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Error is here, once I call this it will display error "Automation
error -2147417848" but it runs OK on win2000 & XP


MsgBox oItem.Subject
If oItem.Attachments.Count > 0 Then
'oItem.Attachments.Item(1).SaveAsFile "c:\temp\" &
oItem.Attachments.Item(1).DisplayName
End If

Next

GoTo noerror

ErrorHandler:
MsgBox Err.Description

noerror:

Set oItem = Nothing
Set oFldr = Nothing
Set oNs = Nothing
Set oOutlook = Nothing

The code runs fine on Win2000 & XP but It always error on 98 PC.

Thanks for any help!!!

Song
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top