Sub Initialize
Dim session As New NotesSession
Dim workspace As New NotesUIWorkspace
Dim db As NotesDatabase
Set db = session.CurrentDatabase
Dim collect As NotesDocumentCollection
Set collect = db.UnprocessedDocuments
If collect.count = 0 Then
Msgbox " No Document(s) selected!", 0 + 16
Exit Sub
End If
Dim fieldname As String
fieldname = Inputbox( "Enter the name of the field you want to create or write to." , "Field Name")
'exit if no fieldname is specified
If fieldname = "" Then Exit Sub
Dim fieldvalue As String
fieldvalue = Inputbox( "Enter the value for the " & fieldname & " field." , "Field Value")
'stamp all new values
Call collect.StampAll( fieldname , fieldvalue )
'refresh the current view
Call workspace.viewrefresh
End Sub