Hi, ich weiß nicht, ob dir das unten stehende Script (zumindest als Ansatz) weiterhilft... aus einem NotesDoc wird ein Word-Objekt(Document) erstellt und mit Daten aus dem NotesUIDocument befüllt und diesem dann angehängt...
Sub Click(Source As Button)
' ###########################################################
' # Mit diesem Script werden Word-Dokumente erstellt und deren Feldern mit den
' # Werten aus den Feldern des NotesUIDocumentes gefüllt.
' # Das Word-Object wird beim Speichern des Dokumentes als EmbedObject
' # angehängt.
' # Eine nachträgliche Änderung des Dokumentes ist durch dieses Script
' # nicht möglich!
' ###########################################################
' ----- Deklarationen
Dim session As New NotesSession
Dim workspace As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Set uidoc = workspace.CurrentDocument
Dim todaydate As New notesdatetime("Today")
Dim word As Variant
Dim wordoc As Variant
Dim zimmer As String
' ----- Vordefinierte Variablen (oder aus Feldern des Front-End-Documents gelesene Werte)
todaysdate = todaydate.localtime
Zimmer = uidoc.FieldGetText("Zimmer")
Auskunft = uidoc.FieldGetText("Auskunft")
Fon = uidoc.FieldGetText("Fon")
Fax = uidoc.FieldGetText("Fax")
IhrZeichen = uidoc.FieldGetText("IhrZeichen")
IhreNachrichtVom = uidoc.FieldGetText("IhreNachrichtVom")
MeinZeichen = uidoc.FieldGetText("MeinZeichen")
Datum = uidoc.FieldGetText("Datum")
' ----- Word-Object erstellen
Set word = CreateObject("Word.Application")
' ----- Erstellt neues Dokument auf der Basis der hier eingegebenen Word-Vorlage
Call word.documents.add("Return and Uplift 2.dot")
' ----- Handle für das aktive Word-Dokument
Set worddoc = word.activedocument
' ----- Felder im Word-Dokument füllen.
worddoc.FormFields(1).result = Zimmer
worddoc.FormFields(2).result = Auskunft
worddoc.FormFields(3).result = Fon
worddoc.FormFields(4).result = Fax
worddoc.FormFields(5).result = IhrZeichen
worddoc.FormFields(6).result = IhreNachrichtVom
worddoc.FormFields(7).result = MeinZeichen
worddoc.FormFields(8).result = Datum
filename$ = "c:\\temp\\notesword.doc"
worddoc.saveas(filename$) ' --- Word-Dokument speichern
word.visible = True ' --- Word nicht anzeigen
word.quit ' --- Word schließen
' ----- Datei (WordDoc) anhängen
Dim RTItem As NotesRichTextItem
Dim doc As NotesDocument
Set doc = uidoc.Document
Set RTItem = New NotesRichTextItem(doc, "Body") ' --- Anhang (erzeugte Datei) einfügen!
Call RTItem.EmbedObject(EMBED_ATTACHMENT, "", filename$)
End Sub
HTH
Ich weiß die Frage zielt hier explizit auf COM ab. Aber warum etwas nehmen, dass nicht funktioniert, wenn es etwas gibt, dass sehr wohl funktioniert. Ich finde zwar den gesamten Ansatz des ursprungsposter nicht sinnvoll, aber bitte.
Man kann sehr wohl von VBA auf das UI zurückgreifen. Hier ein Auszug aus der Hilfe:
Notes registers itself as an OLE automation server and provides the following OLE automation objects:
Notes.NotesUIWorkspace provides access to the Domino UI objects.
Notes.NotesSession provides access to the Domino Objects (that is, the back-end objects).
External applications can create and reference the automation objects, then work down through the object hierarchies. For example, a Visual Basic application might contain the following code:
Set workspace = CreateObject("Notes.NotesUIWorkspace")
Set doc = workspace.CurrentDocument
Wobei wie gesagt, ich würde einen ganz anderen Ansatz wählen, da dieser sehr riskant ist, aber prinzipiell würde es funktionieren.
Grüße
Ralf