Hi,
versuchs mal damit Ich habe es etwas verkürzt und es wird eine Vorlage aus einem anderen Notesdokument benutzt, das must Du ggf. entfernen:
Sub Postopen(Source As Notesuidocument)
Dim session As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim view As NotesView
Dim object As NotesEmbeddedObject
Dim handle As Variant
Dim WordObj As Variant
Dim rtitem As NotesRichTextItem
'Check if new document, if yes create new word doc, if not open from document
If Source.IsNewDoc Then
'Copy Letter from template to c:\temp\temp.doc and then attach to new document
Set db = session.CurrentDatabase
Set view = db.getView("Standard Templates")
Set doc = view.GetDocumentByKey("Standard Letter",True)
Set object = doc.GetAttachment( "letter.doc" )
Call object.ExtractFile( "c:\temp\temp.doc" )
Call Source.GotoField( "Body" )
Call Source.CreateObject("Letter","","c:\temp\temp.doc")
Set WordObj = Source.GetObject( "Letter" )
'Aktiviert Word als aktive Anwendung
WordObj.activate
WordObj.Fields.Update
WordObj.Application.Visible=True
WordObj.Application.WindowState = 1
WordObj.Windows.Add
WordObj.Application.Activate
Elseif Source.Inpreviewpane = False Then
'Get object and activate Word
Set WordObj = Source.GetObject( "Letter" )
WordObj.activate
WordObj.Application.Visible=True
WordObj.Application.WindowState = 1
WordObj.Windows.Add
WordObj.Application.Activate
End If
End Sub