Automation object error

I am getting an automation object error when constructing this email message in Outlook. I am also attaching an embedded word document from a Notes document to the Outlook email message in the same code. This worked just fine for a year or so and then am just getting the error. The only change I can think of is that recently we got Outlook 2003 and Word 2003 (upgrade from 2000). The code error’s at the .Display part. Any help is appreciated. Thanks

Dim ws As New NotesUIWorkspace

Dim session As New NotesSession 

Set uidoc = ws.Currentdocument

Set doc = uidoc.document	



Set session = New NotesSession



Call doc.save(False,True)



'save it out to the temp directory 

Set rtitem = doc.GetFirstItem( "Body" )	

Set object = rtitem.GetEmbeddedObject("Microsoft Word Document" )

If object Is Nothing Then

	Msgbox "A embedded Word Document could not be found.",0+16,"Error - Process Cancelled"

	Exit Sub

End If





	

Set handle = object.Activate( False )

title = Evaluate(|@replacesubstring(Title;"/";"")|,doc) 

filename = "c:\Temp\"& Title(0) & ".doc"



handle.SaveAs(filename) 

handle.application.quit(True)

’ Set Outlook object

Set appOutl = CreateObject("Outlook.Application")



Set myNameSpace = appOutl.GetNameSpace("MAPI")



On Error Goto errormsg 'if the user does not have outlook open

Set myItem = appOutl.CreateItem(0)  '''this is the place where we want a msg if oulook is not online

’ Add subject and body text.

With myItem

	.to = doc.ToAuditee(0)

	.cc = doc.ccAuditee(0)    

’ Add the Word doc

	With  .attachments.Add(filename, 1, 1, doc.ProcedureTitle(0) & Cstr(Today)&".doc") 

	End With

	'    Display Mail to user

	.Display

End With	

'     Close object references.

Set appOutl = Nothing

Set myItem = Nothing

Set recMessage = Nothing

Subject: RE: Automation object error

MS change their API, your code breaks, there is a lesson here somewhere.In fairness to Microsoft (which hurts) the chances are that this is some kind of attempt to stem the flood of Outlook worm viruses. Your code is kind of doing stuff that a virus might want to do if you think about it. There might be a new way to do what you want, but it might be blocked altogether.

Subject: RE: Automation object error

I have the same problem. It first appeared on my own computer after having to repair windows xp and reintall all patches and updates, but then it appeared on 2 other computers. One of the computers has had MS updates installed recently, the other has not. Many other computers in our environment have had all available updates installed and many have not, but only 3 computers get this error. It happens in any of several Lotus databases that use the .display call in Lotus Script to generate an email in Outlook.

My first thought was that MS changed code, but I can’t seem to pin it on that.

Subject: Automation object error with Outlook

Just had the same error on -hic- many PC since they got updated by MS.So it is definately linked to the change of API by MS but it works all the way of my script, it only shows an error on the “.Display” otherwise the new memo I creates in LS is displayed successfuly.

How can we find out the new API calls we can safely use ?

I’ll continue to investigate and post here if I finda workaround to avoid this error message.

Please let us know if you have too.

Subject: No-one uses Script to create Outlook object ?

The sandbox submited in 2000 was working up to now but from this thread you will understand that it’s not anymore without error message.sandbox:

http://www-10.lotus.com/ldd/sandbox.nsf/Threads/477A6505F50A24178525688D00704DF4?OpenDocument

Can anyone tell us if they use a different approach to call Outlook object ?

thanks.

Subject: Automation object error

I coded around this error with the following code …

’ Display Mail to user

    On Error Resume Next

    .Display

    If Err <> 0 Then 

        If Err <> 207 Then

Messagebox ("An Error has occurred # :" & Err)

        End If

    End If

Subject: RE: Automation object error

Edward, you’re a STAR!

Subject: RE: Automation object error

Love this. Thanks Ed. You’re the man!