Excel macro for Changing the Email address in Lotus Domino

This macro when run can read the Excel file & replace the old email address in person record with new email address. 

 Excel Format:

Macro:

 

Sub ModifyForwardingaddress()

s.Initialize

Dim extendedaddressbook As NotesDatabase

Dim view As NotesView

Dim result As NotesDocumentCollection

Dim entry As NotesDocument

Set extendedaddressbook = s.GetDatabase(“”, “xdir.nsf”, False)

For i = 2 To 3

ShortName = Trim(Cells(i, 2).Value)

newemailid = Trim(Cells(i, 4).Value)

strquery = “@LowerCase(ShortName)=” & Chr(34) & LCase(ShortName) & Chr(34)

Set result = extendedaddressbook.Search(strquery, Nothing, 0)

If result.Count = 1 Then

Set entry = result.GetFirstDocument

Call entry.ReplaceItemValue(“Mailaddress”, newemailid)

Call entry.Save(False, True)

Cells(i, 5).Value = 1

Else

Cells(i, 5).Value = 0

End If

Next

MsgBox “done”

End Sub

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s