Hallo Frank,
so habe ich das nun gemacht.
Nach meinen ersten Tests scheint es zu funktionieren ...
Imports System.IO
Imports System.Xml
Module Module_ToDo
Dim Datum As String = Format$(Date.Today, "yyyy-MM-dd")
Dim Zeit As String = TimeOfDay.ToString("HH-mm-ss") 'AM/PM
Dim DateMyNotes As String = ""
Public Sub CreateEMail_ToDo()
If AccessToDoMail = True Then
ReadMySettingsMyNotes()
If Not DateMyNotes = Datum Then
If Form_PlanningGuide.TextBox_MyNotes.Text <> "" Then
Dim Outlook As Object
Dim olMail As Microsoft.Office.Interop.Outlook.MailItem
Dim TextTaskMail As String = ""
Outlook = CreateObject("Outlook.Application")
Dim a As Integer
TextTaskMail = "Hello " & currentUser_FirstName & vbNewLine _
& vbNewLine & "Herewith you will receive the summary of" & _
"your private 'MyNotes' from tabpage PinBoard (" & _
"PlanningGuide)." & _
vbNewLine & "Please check the details." & vbNewLine & _
"-----------------------------------------------------" & _
"-----------------------------------------------------" & _
"----" & vbNewLine & _
Form_PlanningGuide.TextBox_MyNotes.Text
TextTaskMail = Replace(TextTaskMail, vbCrLf, " <br> ", 1, _
-1, 1)
TextTaskMail = Replace(TextTaskMail, vbNewLine, " <br> ", _
1, -1, 1)
TextTaskMail = Replace(TextTaskMail, Chr(13), " <br> ", 1, _
-1, 1)
TextTaskMail = Replace(TextTaskMail, Chr(10), " <br> ", 1, _
-1, 1)
olMail = Outlook.CreateItem(a)
olMail.Subject = "MyNotes" & " - " & Datum & " " & Zeit & "" & _
"- " & currentUser_FirstName & " " & currentUser_LastName
olMail.HTMLBody = "<div style='font-size:11pt; font-family:" & _
"MetaPlusLF; '>" & TextTaskMail & "</div>"
'##########################################################
' ###############
'Mail To/CC
olMail.To = currentUser_LastName & " " & _
currentUser_FirstName
'Mail To/CC
'##########################################################
' ###############
olMail.Send()
Outlook = Nothing
olMail = Nothing
WriteMySettingsMyNotes()
End If
End If
End If
End Sub
Public Sub ReadMySettingsMyNotes()
Dim xml_Doc As XmlDocument
Dim xml_NodeLoad As XmlNode
Dim xml_PathMyNotes As String = My.Application.Info.DirectoryPath & _
"\Data" & "\PlanningGuideSettings_" & user & ".xml"
If IO.File.Exists(xml_PathMyNotes) Then
xml_Doc = New XmlDocument()
xml_Doc.Load(xml_PathMyNotes)
If (xml_Doc.SelectSingleNode( _
"Settings/UserSettings/MyNotes/Item_1") Is Nothing = False) Then
xml_NodeLoad = xml_Doc.SelectSingleNode( _
"Settings/UserSettings/MyNotes/Item_1")
If xml_NodeLoad.InnerText <> "" Then
DateMyNotes = xml_NodeLoad.FirstChild.Value
End If
End If
End If
End Sub
Public Sub WriteMySettingsMyNotes()
Dim xml_Doc As XmlDocument
Dim xml_NodeWrite As XmlNode
Dim xml_PathMyNotes As String = My.Application.Info.DirectoryPath & _
"\Data" & "\PlanningGuideSettings_" & user & ".xml"
Dim NodeText As String = ""
If IO.File.Exists(xml_PathMyNotes) Then
xml_Doc = New XmlDocument()
xml_Doc.Load(xml_PathMyNotes)
If (xml_Doc.SelectSingleNode( _
"Settings/UserSettings/MyNotes/Item_1") Is Nothing = False) Then
xml_NodeWrite = xml_Doc.SelectSingleNode( _
"Settings/UserSettings/MyNotes/Item_1")
xml_NodeWrite.InnerText = Datum
End If
xml_Doc.Save(xml_PathMyNotes)
End If
End Sub
End Module Grüße
Stefan |