Und ich hab auch schon gleich das erste Prolem:
Die Datei "Return and Uplift.dot" liegt auf dem Server. Auf diesem Server ist kein Word installiert. Ist es auch mögilch, dass ich die Datei bei mir Lokal liegen haben kann?
Die Fehlermeldung die erscheint lautet:
Dieser Befehl ist nicht verfügbar, weil kein Dokument geöffnet ist.
Sub Click(Source As Button)
Dim s As New notessession
Dim todaydate As New notesdatetime("Today")
Dim word As Variant
Dim wordoc As Variant
Dim todaysdate As String
Dim orderid As String
Dim producedby As String
Dim storeid As String
Dim customername As String
Dim address As String
Dim citytown As String
Dim postcode As String
Dim daytimeno As String
Dim eveningno As String
'Predefined values: (replace with field values from uidoc)
' todaysdate = todaydate.localtime
orderid = "2183763248"
producedby = s.username
storeid = "12345"
customername = "John Doe"
address = "Apartment 5c, 5 Test Avenue"
citytown = "Testtown"
postcode = "XX5 5XX"
daytimeno = "1234567890"
eveningno = "0987654321"
'Create the Word object:
Set word = CreateObject("Word.Application") 'Create Word object
Call word.documents.add("D:\domino\domdata\Entwicklung Felix\Return and Uplift.dot") 'Create a new document based on the template "Return and Uplift.Dot"
Set worddoc = word.activedocument 'Get a handle for the active document
'Assign the field values:
worddoc.FormFields(1).result = todaysdate
worddoc.FormFields(2).result = orderid
worddoc.FormFields(3).result = producedby
worddoc.FormFields(4).result = storeid
worddoc.FormFields(5).result = customername
worddoc.FormFields(6).result = address
worddoc.FormFields(7).result = citytown
worddoc.FormFields(
.result = postcode
worddoc.FormFields(9).result = daytimeno
worddoc.FormFields(10).result = eveningno
worddoc.saveas(customername) 'save the document with the filename of "John Doe.doc"
word.visible = True 'Comment this line if you don't want to show Word.
'word.quit 'remove comment if you want to close rather than show Word.
End Sub