Dim
strPath
As
String
Dim
strFile
As
String
Dim
strFileLast
As
String
Dim
dtmFileLast
As
Date
strPath = "P:\ISK\PROJEKTE\ASE_PSM5\010 Loopcheck\030 Kaufmänische Abwicklung\Tagesmeldungen\"
If
Right$(strPath, 1) <>
"\" Then strPath = strPath & "
\"
strFile = Dir$(strPath)
Do
While
strFile <>
""
If
dtmFileLast < FileDateTime(strPath & strFile)
Then
dtmFileLast = FileDateTime(strPath & strFile)
strFileLast = strFile
End
If
strFile = Dir$()
Loop
Debug.Print strPath & strFileLast, dtmFileLast
Dim
Nachricht
As
Object
, OutlookApplication
As
Object
Set
OutlookApplication = CreateObject(
"Outlook.Application"
)
Set
Nachricht = OutlookApplication.CreateItem(0)
With
Nachricht
.
To
=
"xxxx@xxx.de"
.Subject =
"Tagesmeldung vom "
&
Date
.attachments.Add dtmFileLast
.Body =
"Hallo Moritz, anbei sende ich dir die Aktuelle Tagesmeldung."
.Display
End
With
Set
OutlookApplication =
Nothing
Set
Nachricht =
Nothing