View Single Post
  #1  
Old September 24th 08, 01:56 AM posted to microsoft.public.outlook.program_vba
Norm[_2_]
external usenet poster
 
Posts: 4
Default Problem automating Outlook 2007 in VB6

Hi,

I thought I would try this question here since VBA is very similar to VB6.

I have the following code, which worked find in previous versions of Office
and Outlook so I am assuming Office 2007 is having a problem with resolving
email address. On these two lines I am getting just an object or application
defined error, but no explanation of what the error is.

oMail.Recipients.ADD MyReport

bCheck = oMail.Recipients.ResolveAll

objEmail and oMail are dim'ed as objects, while bCheck is boolean.

Code:

Set objEmail = CreateObject("Outlook.Application")

Do

Set oMail = objEmail.CreateItem(olMailItem)

bCheck = False

sPath = CStr(i)

MyReport = sGetINI(sIniPath, "Path", sPath, Default)

If MyReport = "" Or MyReport = "0" Then Exit Do

oMail.Recipients.ADD MyReport 'First error generated here

bCheck = oMail.Recipients.ResolveAll 'This line will also generate
an error

If Not bCheck Then

AllReports2 = MyPath2 & MyReport

MyPath2 = AllReports2 & ";"

GoTo Skip

End If

AllReports = MyPath & MyReport

MyPath = AllReports & ";"

Skip:

Set oMail = Nothing

i = (i + 1)

Loop




--
Norm

Don't blame me, my programming is
self-taught and my teacher was not
very experienced. :-)

normfowler_don't


Ads