Changing domain in a location document with script

It works in R5, but not with a R6-client. Failure: Illegal function call

Sub Initialize

Dim db As NotesDatabase

Dim view As NotesView

Dim entryset As NotesViewEntryCollection

Dim entry As NotesViewEntry

Dim doc As NotesDocument

Dim imail As Variant

Set db = New NotesDatabase(“”, “names.nsf”)

Set view = db.GetView(“Locations”)

Set entryset = view.AllEntries

Set entry = entryset.GetFirstEntry

Do Until entry Is Nothing

Set doc = entry.Document

imail = doc.imailaddress(0)

imail = Left$(imail, Instr(imail, “olddomain.com”) - 1) & “newdomain.com

doc.imailaddress = imail

Call doc.save(True,True)

Set entry = entryset.GetNextEntry(entry)

Loop

End Sub

What’s wrong and works in both r5 and r6 ?

Any help for this ?

Subject: RE: Changing domain in a location document with script

Please see these links:How to debug Notes applications

How to ask a technical question about Notes