I have a document open, which is my frontend UIDocument. This document has an embedded view and I use every document in this view to create another document, getting values from both the uidocument and the documents in the embedded view. So far so good as you can see from my code. BUT I also want to print this newly created document and this is my question: How do I do that? I suppose I either have to bring the new document to a frontend ui-document (which seems to be the best way) or I keep the newly created documents in a temp view or something and print them from there. Just don’t realize how to to this.
Sub Click(Source As Button)
Dim doc As NotesDocument
Dim docNew As NotesDocument
Dim s As New NotesSession
Dim db As NotesDatabase
Set db = s.currentdatabase
Dim dc As NotesDocumentCollection
Dim ws As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Set uidoc = ws.currentdocument
If (uidoc Is Nothing) Then
Messagebox "Det finns inget dokument"
Exit Sub
End If
Set dc = db.UnprocessedDocuments
If dc.count <> 0 Then
Set doc = dc.GetFirstDocument()
Do Until doc Is Nothing
Set docNew = db.CreateDocument
docNew.Form = "Transportsperma"
docNew.H_NamnH = uidoc.FieldGetText("H_NamnH")
docNew.Datum = Cdat(uidoc.FieldGetText("Datum"))
docNew.Tid = Cdat(uidoc.FieldGetText("Tid"))
docNew.Transport = doc.Transport
docNew.Konc = uidoc.FieldGetText("Konc")
docNew.Mot = uidoc.FieldGetText("Mot")
docNew.SpV = uidoc.FieldGetText("SpV")
docNew.Antibiotika = uidoc.FieldGetText("Antibiotika")
docNew.SpGrT = uidoc.FieldGetText("SpGrT")
docNew.MESpT = uidoc.FieldGetText("MESpT")
docNew.DosVolT = uidoc.FieldGetText("DosVolT")
docNew.SamlNr = uidoc.FieldGetText("SamlNr")
docNew.SamlNr2 = uidoc.FieldGetText("SamlNr2")
docNew.H_Namn = doc.H_Namn
docNew.K_Nr = doc.K_Nr
docNew.H_Agare = doc.H_Agare
docNew.ComputeWithForm False,False
docNew.save True,False
Set doc = dc.GetNextDocument(doc)
Loop
ws.ViewRefresh
Dim closedView As NotesView
Set closedView = s.CurrentDatabase.GetView("(NotesThreadsChecklistClosed)")
If Not closedView Is Nothing Then closedView.Refresh
End If
End Sub