Dim workspace As New NotesUIWorkspace
Dim session As New NotesSession
Dim db As NotesDatabase
Dim uidoc As NotesUIDocument
Dim item As NotesItem
Set db = session.CurrentDatabase
Set uidoc = workspace.CurrentDocument
Set doc = uidoc.Document
'prep
If uidoc.EditMode Then Call doc.Save
( True, True) 'was uidoc.Save
'switch to view with "Requistion Print" form
doc.SaveOptions = 0
doc.Form = "FORM"
Set uidoc = workspace.EditDocument
(True, doc, False)
Set doc = uidoc.Document
'print
Call uidoc.Print
'restore to normal
Call uidoc.Close
'save minor changes
Set uidoc = workspace.EditDocument
(True, doc, False)
Set doc = uidoc.Document
doc.SaveOptions = 1
Set item = doc.ReplaceItemValue
( "reqR_Printed", "Yes" )
doc.Form = "Requisition"
Call uidoc.Refresh
Call doc.Save( True, True)
Call uidoc.Close
'print the child documents
Dim parentdoc As NotesDocument
Dim childdoc As NotesDocument
Dim responses
As NotesDocumentCollection
Set parentdoc =
workspace.CurrentDocument.Document
Set responses = parentdoc.Responses
For i = 1 To responses.Count
'loop thru the links
Set childdoc =
responses.GetNthDocument(i)
Set uidoc =
workspace.EditDocument( False, childdoc )
Call uidoc.Print
Call uidoc.Close
Next
End Sub
Call notesUIDocument.Print( [ numCopies%, [, fromPage%, [, toPage%, [,draft ]]]] )
See the Developer help file for more details.
Do you have comments on this Ask the Expert question and response? Let us know.
This was first published in February 2005