Domino 9 und frühere Versionen > ND6: Entwicklung

Antwort mit Vorlage übernimmt keinen Anhang

<< < (2/5) > >>

Axel:
Ist die Zeile

Dim db As Notesatabase

in deinem Code enthalten?

Poste bitte mal den gesamten Code.


Axel

waldt:
Hallo!
Ich habe exakt das eingefügt wass du mir geschrieben hast.

habe es jetzt abgeändert:

Sub Click(Source As Button)
   Dim replyToUIDoc As NotesUIDocument
   Dim replyToDoc As NotesDocument
   Dim stationeryDoc As NotesDocument
   Dim stationeryBodyItem As NotesRichTextItem
   Dim db As Notesdatabase
   
   Set db = session.CurrentDatabase
   
   Set collection = ws.Picklistcollection(PICKLIST_CUSTOM, False, db.server, db.filepath, "Stationery", "Select Stationery", "Please select stationery for new memo.")
   
   Set stationeryDoc = collection.getfirstdocument
   
   If Not stationeryDoc Is Nothing Then
      
      Set replyToDoc = New NotesDocument(db)
      replyToDoc.Form="Reply"
      
      Set stationeryBodyItem = stationeryDoc.getfirstitem("Body")
      Call replyToDoc.CopyItem( stationeryBodyItem, "Body" )
      
      Set replyToUIDoc = ws.EditDocument(replyToDoc)
      Call replyToUIDoc.Refresh(True)
      
   End If
End Sub


Neuer Fehler beim starten der Aktion:

Variant does not contain an object


Gruß
Thomas

Axel:
Mein Code war eigentlich nur als Ersatz für den Bereich der Anlage des neuen Dokumentes gedacht. Deine Dim - Anweisungen hättest du übernehmen sollen.

Hier dann noch mal der komplette Code:

Sub Click(Source As Button)
  Dim ws As New NotesUIWorkspace
  Dim session As New NotesSession
  Dim db As NotesDatabase
  Dim collection As notesdocumentcollection
  Dim replyToUIDoc As NotesUIDocument
  Dim replyToDoc As NotesDocument
  Dim stationeryDoc As NotesDocument
  Dim stationeryBodyItem As NotesRichTextItem
 
  Set db = session.CurrentDatabase
     
  Set collection = ws.Picklistcollection(PICKLIST_CUSTOM, False, db.server, db.filepath, "Stationery", "Select Stationery", "Please select stationery for new memo.")

  Set stationeryDoc = collection.getfirstdocument
   
  If Not stationeryDoc Is Nothing Then

    Set replyToDoc = New NotesDocument(db)
    replyToDoc.Form="Reply"
 
    Set stationeryBodyItem = stationeryDoc.getfirstitem("Body")
    Call replyToDoc.CopyItem( stationeryBodyItem, "Body" )
 
    Set replyToUIDoc = ws.EditDocument(replyToDoc)
    Call replyToUIDoc.Refresh(True)
   
  End If
End Sub


Am besten fügst du bei allen Scripts in den [Options] - Abschnitt die Zeile

Option Declare

ein.

Dann kann es dir nicht passieren, dass du nicht deklarierte Variablen benutzt.


Axel

waldt:
Hallo,

OK, habe ich gemacht.
Er ruft nun die Vorlagen auf.
Bei der Auswahl einer Vorlage mit oder ohne Anhang kommt folgende fehlermeldung.

Document command is not available

Vorlage wird nicht eingefügt.

Hast du da noch einen Vorschalag?

Gruß
Thomas

Axel:
Sorry, ich hab' beim EditDocument den Parameter für den EditModus vergessen. Somit öffnet er das Dokument im Lesemodus und der Refresh fährt gegen die Wand.

....
    Set stationeryBodyItem = stationeryDoc.getfirstitem("Body")
    Call replyToDoc.CopyItem( stationeryBodyItem, "Body" )
 
    Call replyToDoc.Save(True,Save) 'Temp. Speichern des Backend-Doc. damit RTF-Feld angezeigt wird.
    Set replyToUIDoc = ws.EditDocument(True, replyToDoc)
    Call replyToUIDoc.Refresh(True)
    Call replyToDoc.Remove(True) 'Das Dokument, das im Backend erstellt wurde, löschen
....   

Edit: Ich habe noch zwei Zeilen eingefügt, damit der Inhalt des RTF angezeigt wird.

Axel

Navigation

[0] Themen-Index

[#] Nächste Seite

[*] Vorherige Sete

Zur normalen Ansicht wechseln