Replace String in multiple documents

Hi,

I have a requirement. In that, user selects multiple documents and clicks on a button. On click of that button user should be given a screen where he has two fields. He gives input for those 2 names. Then i have to get hold of those names. In all the selected documents, i need to find name1 and replace with name2.

Can anyone give me an idea about how to acheive this.

Thanks in Advance.

Subject: RE: Replace String in multiple documents

Use LotusScript. Use the Dialogbox method to query for the two strings. You’ll have to design a special form or subform for this. There’s an option to Dialogbox that lets you specify a document – use that, passing in a new NotesDocument that you created in memory and never saved. Then you loop thru the docs in the usual way. Do you have to go through all items in the selected documents, or is the replacement limited to certain fields?

Subject: RE: Replace String in multiple documents

I have tried using a dialogbox, but the values did not get back…here is the code i have used

Dim workspace As New notesuiworkspace

Dim s As New notessession

Dim db As NotesDatabase

Dim uidoc As NotesUIDocument

Dim doc As NotesDocument





Set db = s.CurrentDatabase

Set uidoc = workspace.CurrentDocument

Set doc = uidoc.Document

Dim dlgdoc As NotesDocument

Set dlgdoc = New notesdocument(db)

Call workspace.DialogBox _

( "Dialog1", True, True, , True, _

False, False, "Please enter names",dlgdoc ,True )		

Call uidoc.refresh



Msgbox dlgdoc.test1(0)

Msgbox dlgdoc.test2(0)

test1 and test2 are the fields that i have used in the dialog box. How do i get the values of those in the code.

Subject: RE: Replace String in multiple documents

You’re on the right track, but the options you are passing to DialogBox specify noNewFields=True.