Editing each document in a view

Hi,

I have documents in a view in which I’d like to open each document, edit the document and then save and close it. This is my code that I was trying to use - I tried it on a couple of documents, but it actually opened the document, left it open, and didn’t seem to edit the document anyway! If anyone can help that would be great.

Sub Initialize

Dim session As New NotesSession

’ Dim db2 As New NotesDatabase(“Abeckett”, “QoN\Staging\DPCAnswers.nsf”)

Dim StagingDatabase As NotesDatabase

Dim FromView As NotesView

Dim Workspace As New NotesUIWorkspace

Dim SourceDoc As NotesDocument

Dim destdoc As NotesDocument

Dim nItem As NotesItem

Dim Acount As Integer

Dim EmailAs() As String

Dim x As Integer

Dim Body As String

Dim ActionType As String

Dim currentdb As NotesDatabase

Dim UiDoc As NotesUiDocument	

Dim UiView As NotesUiView



Set UiView = workspace.CurrentView



Set currentdb = session.CurrentDatabase

Set FromView = currentdb.GetView("Questions By Number")

Set SourceDoc = FromView.GetFirstDocument()

Acount = 0

’ FromView.AutoUpdate = False

While Not (SourceDoc Is Nothing)

’ SourceDoc.QuestionText = “A”

	Call Workspace.EditDocument(True, SourceDoc)

	Call SourceDoc.Save(True, True, True)

	

	

	Set SourceDoc = FromView.GetNextDocument(SourceDoc)

Wend

End Sub

Cheers,

Subject: Editing each document in a view

Hi,

Document left open, because You didn’t close it before edit next document.

Why You open each document in the view? Maybe you can achieve what you want witout openning each document.

Konrad

Subject: Editing each document in a view

Hi,

please try it:

set doc = SourceDoc

set ws = workspace

Set uidoc =ws.EditDocument(True, doc)

Call uidoc.Save

Call uidoc.Close(True)

Regardrds,

<M