Domino 9 und frühere Versionen > ND6: Entwicklung

Notes und MS Word

(1/1)

el-coto:
Hallo,

kann mir jemand ein Beispielsript senden, womit ich aus einer Notes-Adressdatenbank
per Schaltfläche ein MS Word Briefvorlage mit den Adressfeldern füllen kann.

Alex

MartinG:
Eines das ich einsetze:

   Dim word As Variant
   Dim wordoc As Variant
   Dim projektpfad As String
   Dim worddateiname As String
   Dim wordpfaddateiname As String
   Dim vorlage_modulablage As String
   
   Dim worddoc As Variant                
   
   Dim uiws As New NotesUIWorkspace
   Dim uidoc As NotesUIDocument
   Dim session As New NotesSession
   Dim doc As NotesDocument
   
   Set uidoc = uiws.CurrentDocument
   Set doc = uidoc.Document
   Set fs = CreateObject("Scripting.FileSystemObject")
   
   
' Pfade / Dateinamen  erstelllen
   vorlage_modulablage = "d:\daten\lotus\konzertvorlage.dot"
   worddateiname = "Konzert.DOC"
         
' Notes Dokument speichern
'   Call uidoc.Save
   
'Create the Word object:
   Set word = CreateObject("Word.Application")    'Create Word object
   Call word.documents.add(vorlage_modulablage)    'Create a new document based on the template
   Set worddoc = word.activedocument    'Get a handle for the active document
   
' Assign the field values:
   worddoc.FormFields("fd_topfeld1").result = uidoc.FieldGetText("fd_konzertort")
   worddoc.FormFields("fd_topfeld2").result = uidoc.FieldGetText("fd_termin")
   worddoc.FormFields("fd_1").result = uidoc.FieldGetText("fd_veranstaltung")
   worddoc.FormFields("fd_1a").result = uidoc.FieldGetText("fd_traeger")
   worddoc.FormFields("fd_2").result = uidoc.FieldGetText("fd_ansprechpartner")
   worddoc.FormFields("fd_3").result = uidoc.FieldGetText("fd_telefonkontakt")
   worddoc.FormFields("fd_4").result = uidoc.FieldGetText("fd_ueberorg")
   worddoc.FormFields("fd_5").result = uidoc.FieldGetText("fd_ubernachtungsort")
   worddoc.FormFields("fd_6").result = uidoc.FieldGetText("fd_paverleiher")
   worddoc.FormFields("fd_7").result = uidoc.FieldGetText("fd_lichtverleiher")
   worddoc.FormFields("fd_8").result = uidoc.FieldGetText("fd_soundcheckzeit")
   worddoc.FormFields("fd_9").result = uidoc.FieldGetText("fd_konzertbeginn")
   worddoc.FormFields("fd_10").result = uidoc.FieldGetText("fd_beginngig")
   worddoc.FormFields("fd_11").result = uidoc.FieldGetText("fd_spieldauer")
   
   worddoc.FormFields("fd_12").result = uidoc.FieldGetText("fd_konzertgage")
   worddoc.FormFields("fd_13").result = uidoc.FieldGetText("fd_fahrtkosten")
   worddoc.FormFields("fd_14").result = uidoc.FieldGetText("fd_gesamtsumme")
   worddoc.FormFields("fd_15").result = uidoc.FieldGetText("fd_mwst")
   worddoc.FormFields("fd_16").result = uidoc.FieldGetText("fd_gesamt_inkl")
      
   word.visible = True
   
Ansonsten:

www.notes.net/sandbox.nsf - suche mal dort nach Word... - da gibt es massig Beispiele...

Gruss
Martin

Axel:
Hi,

schau auch mal hier: Word-Automation

Ist zwar unter R5 erstellt worden, sollte aber auch unter 6 laufen.


Axel

el-coto:
Vielen Dank, hat mir sehr geholfen !

Navigation

[0] Themen-Index

Zur normalen Ansicht wechseln