Autor Thema: Auswahl versenden per Mail  (Gelesen 4030 mal)

Offline kruemelmaus

  • Frischling
  • *
  • Beiträge: 22
Auswahl versenden per Mail
« am: 13.11.17 - 13:50:40 »
Hallo zusammen,

wir haben eine Datenbank erstellt, mit welcher wir nach neuen Handymodellen eine Umfrage (anonym) machen wollen.

Dazu gibt es ein Feld welches vom Mitarbeiter beschrieben werden kann. Als weiteres Element kommt noch ein Sendebutton hinzu.

Diesen habe ich mit dem folgenden Skript erstellt:



Sub Click(Source As Button)
   
   Dim session As New NotesSession
   Dim mailbox As New NotesDatabase("","")
   Dim rtBody 'As NotesRichTextItem
      
   Dim Auswahl As String
   
   
 ' get handle to mail.box on the users current mail server
   Set current = session.CurrentDatabase
   Call mailbox.Open( current.server, "mail.box" )
   
 ' Create a new document in the severs mail box
   Set maildoc = mailbox.CreateDocument
   
   Set ws = New   NotesuiWorkspace    'Represents the current Notes workspace window.
   Set uidoc = ws.CurrentDocument      'Represents the document that's currently open in the Notes workspace.
   
   
   
   maildoc.Form = "Memo"
   maildoc.From = "Order"
   maildoc.SendFrom = "Order"
   maildoc.SendTo = uidoc.FieldgetText("email")
   maildoc.Recipients = uidoc.FieldgetText("email")
   maildoc.Subject = "Bestellung Handy"
   
   Set rtitem = maildoc.CreateRichTextItem( "body" )
   
   
   
   Call rtitem.AppendText( "Liebe Kolleginnen und Kollegen," )
   Call rtitem.AddNewLine(2)
   Call rtitem.AppendText("hiermit wünschen wir uns folgendes Gerät " )
   Call rtitem.AddNewLine(3)
   Call rtitem.AppendText(Auswahl)
   Call rtitem.AddNewLine( 2 )
   Call rtitem.AppendText( "Mit freundlichem Gruß" )
   Call rtitem.AddNewLine( 2 )
   Call rtitem.AppendText("IT Services")
   Call rtitem.AddNewLine(3)
   
   maildoc.PostedDate = Now()
   maildoc.ComposedDate = Now()
   maildoc.DeliveredDate = Now()
   maildoc.Principal = "IT-Services"
   maildoc.EncryptOnSend = False
   
   Call maildoc.Save( True, False )
   
   Call uidoc.fieldsettext ("send_mail", "versendet")
   'Call uidoc.save(True,True)
   
End Sub

Ich schaffe es aber irgendwie nicht, das Feld mit dem Wunsch mit in den Mailtest einzubinden. Das Feld Auswahl sollte mit dem Wunsch gefüllt werden.

Wer kann mir hier helfen. Wie kann ich auf das Feld zugreifen und in die Mail einbinden?


Mit freundlichem Gruß

Oliver

Offline Peter Klett

  • Gold Platin u.s.w. member:)
  • *****
  • Beiträge: 2.713
  • Geschlecht: Männlich
Re: Auswahl versenden per Mail
« Antwort #1 am: 13.11.17 - 14:22:37 »
Dim doc As NotesDocument
Set doc = uidoc.Document

...
Call rtitem.AppendText(doc.Auswahl (0))

Offline kruemelmaus

  • Frischling
  • *
  • Beiträge: 22
Re: Auswahl versenden per Mail
« Antwort #2 am: 14.11.17 - 12:55:13 »
Hallo,

vielen Dank für die Antwort. Allerdings bekomme ich eine Fehlermeldung.
Wenn im Notes Debugger die Zeile
Set doc = uidoc.Document

angesprungen wird kommt folgendes: Variant does not contain an object.

Wo kann ich noch ws ändern?

Gruß

Oliver

Dim doc As NotesDocument
Set doc = uidoc.Document

...
Call rtitem.AppendText(doc.Auswahl (0))


Offline Peter Klett

  • Gold Platin u.s.w. member:)
  • *****
  • Beiträge: 2.713
  • Geschlecht: Männlich
Re: Auswahl versenden per Mail
« Antwort #3 am: 14.11.17 - 13:43:42 »
wo hast Du die Zeile eingebaut?

Offline kruemelmaus

  • Frischling
  • *
  • Beiträge: 22
Re: Auswahl versenden per Mail
« Antwort #4 am: 14.11.17 - 14:44:11 »
wo hast Du die Zeile eingebaut?

Sub Click(Source As Button)
   
   Dim session As New NotesSession
   Dim mailbox As New NotesDatabase("","")
   Dim rtBody 'As NotesRichTextItem
     
   Dim Auswahl As String
   
Dim doc As NotesDocument
Set doc = uidoc.Document
   
 ' get handle to mail.box on the users current mail server
   Set current = session.CurrentDatabase
   Call mailbox.Open( current.server, "mail.box" )
   
 ' Create a new document in the severs mail box
   Set maildoc = mailbox.CreateDocument
   
   Set ws = New   NotesuiWorkspace    'Represents the current Notes workspace window.
   Set uidoc = ws.CurrentDocument      'Represents the document that's currently open in the Notes workspace.
   
   
   
   maildoc.Form = "Memo"
   maildoc.From = "Order"
   maildoc.SendFrom = "Order"
   maildoc.SendTo = uidoc.FieldgetText("email")
   maildoc.Recipients = uidoc.FieldgetText("email")
   maildoc.Subject = "Bestellung Handy"
   
   Set rtitem = maildoc.CreateRichTextItem( "body" )
   
   
   
   Call rtitem.AppendText( "Liebe Kolleginnen und Kollegen," )
   Call rtitem.AddNewLine(2)
   Call rtitem.AppendText("hiermit wünschen wir uns folgendes Gerät " )
   Call rtitem.AddNewLine(3)
   Call rtitem.AppendText(doc.Auswahl (0))
   Call rtitem.AddNewLine( 2 )
   Call rtitem.AppendText( "Mit freundlichem Gruß" )
   Call rtitem.AddNewLine( 2 )
   Call rtitem.AppendText("IT Services")
   Call rtitem.AddNewLine(3)
   
   maildoc.PostedDate = Now()
   maildoc.ComposedDate = Now()
   maildoc.DeliveredDate = Now()
   maildoc.Principal = "IT-Services"
   maildoc.EncryptOnSend = False
   
   Call maildoc.Save( True, False )
   
   Call uidoc.fieldsettext ("send_mail", "versendet")
   'Call uidoc.save(True,True)
   
End Sub

Offline Peter Klett

  • Gold Platin u.s.w. member:)
  • *****
  • Beiträge: 2.713
  • Geschlecht: Männlich
Re: Auswahl versenden per Mail
« Antwort #5 am: 14.11.17 - 14:55:26 »
und wann setzt Du das uidoc, aus dem Du das doc holst?

Offline DominoDancing

  • Aktives Mitglied
  • ***
  • Beiträge: 141
  • Geschlecht: Männlich
  • Kugel im Käfig, lsmf, hurz ...
Re: Auswahl versenden per Mail
« Antwort #6 am: 14.11.17 - 15:55:58 »
Hallo Gekrümel,  ;D

mit anderen Worten: Die Peter-Klett-Zeilen 'Dim doc As NotesDocument' und 'Call rtitem.AppendText(doc.Auswahl (0))' kannst Du stehen lassen, wo sie stehen. Das 'Set doc = uidoc.Document' gehört genau eine Zeile unter Dein 'Set uidoc = ws.CurrentDocument'.

Liebe Grüße
René
... ich fühl' mich so ... Regenbogen ... ;D
... man muss die Ursache des Problems finden ... oder eine Tüte Glitzerfeenstaub ...
... Ich bin rhythm, I'm a dancer und I don't like Influenzer ...

 

Impressum Atnotes.de  -  Powered by Syslords Solutions  -  Datenschutz