Was ich noch nicht ganz verstehe, warum es von heut auf morgen nicht mehr geht,
es wurde in der Zeit auch kein Update gefahren.
Mit "kein Update gefahren" meinst du wohl "kein Windows-Update"... doch wenn du es in Outlook nicht umgestellt hast, macht es das unabhängig davon automatisch im Hintergrund bei jedem Start.
Um dir die Version von Outlook anzeigen zu lassen, gibst du in der Outlook-Hilfe einfach "version" ein... dort steht dann, wie/wo du sie ablesen kannst. Ich habe dann wohl eine andere/älterere Version als du...
"C:\Program Files (x86)\Microsoft Office\root\Office16\OUTLOOK.EXE"
In der MsBox (dann ist es ein COM-Error) wird als Ursache WinDescription = Falscher Parameter angegeben.
Welcher Parameter das ist, kannst du evtl. herausbekommen, wenn du die Funktion nur mit den ersten beiden (weniger geht nicht) Parametern aufrufst... und dann einen weiteren anhängst, bis der Fehler wieder auftritt:
_OL_Wrapper_SendMail($oOutlook, $sCurrentUser, "", "", "Geschriebene Stunden", _ArrayToString($g_aZeiten, ' ', 1, -1, '<br>'), "", $olFormatHTML, $olImportanceHigh)
_OL_Wrapper_SendMail($oOutlook, $sCurrentUser) ; Test 1
_OL_Wrapper_SendMail($oOutlook, $sCurrentUser, "") ; Test 2
...
Oder du testest es so:
;-- TIME_STAMP 2020-09-19 06:56:02 v 0.1
Opt('MustDeclareVars', 1)
#include <OutlookEX.au3>
_OL_ErrorNotify(2) ; 2 - Enable Debugging. Output the debug info to a MsgBox
Global $g_aZeiten[13][2] = [[12], _
['08:00', 'Rainer'], ['08:00', 'Peter'], ['08:00', 'Uwe' ], ['08:00', 'Dieter' ], ['08:00', 'Jens' ], ['08:00', 'Udo' ], _
['08:00', 'Jörg' ], ['08:00', 'Franz'], ['08:00', 'Wolfgang'], ['08:00', 'Siegfried'], ['08:00', 'Willi'], ['08:00', 'Günter']]
Global $oOutlook = _OL_Open()
If @error Then Exit MsgBox(16, "OutlookEX UDF", "Error creating a connection to Outlook. @error = " & @error & ", @extended = " & @extended)
Global $sCurrentUser = $oOutlook.GetNameSpace("MAPI").CurrentUser.Name
If @error Or $sCurrentUser = "" Then Exit MsgBox(16, "OutlookEX UDF: _OutlookEX", "Error $sCurrentUser = " & $sCurrentUser & " @error = " & @error & ", @extended: " & @extended)
;~ _OL_Wrapper_SendMail($oOutlook, $sCurrentUser, "", "", "Geschriebene Stunden", _ArrayToString($g_aZeiten, ' ', 1, -1, '<br>'), "", $olFormatHTML, $olImportanceHigh)
__OL_Wrapper_SendMail($oOutlook, $sCurrentUser, "", "", "Geschriebene Stunden", _ArrayToString($g_aZeiten, ' ', 1, -1, '<br>'), "", $olFormatHTML, $olImportanceHigh)
If @error Then Exit MsgBox(16, "OutlookEX UDF: _OutlookSendMail Wrapper Script", "Error sending mail. @error = " & @error & ", @extended: " & @extended)
_OL_Close($oOutlook)
Func __OL_Wrapper_SendMail($oOL, $sTo = "", $sCc = "", $sBCc = "", $sSubject = "", $sBody = "", $sAttachments = "", $iBodyFormat = $olFormatPlain, $iImportance = $olImportanceNormal)
If $sTo = Default Then $sTo = ""
If $sCc = Default Then $sCc = ""
If $sBCc = Default Then $sBCc = ""
If $sSubject = Default Then $sSubject = ""
If $sBody = Default Then $sBody = ""
If $sAttachments = Default Then $sAttachments = ""
If $iBodyFormat = Default Then $iBodyFormat = $olFormatPlain
If $iImportance = Default Then $iImportance = $olImportanceNormal
If Not IsInt($iBodyFormat) Then SetError(1, 0, 0)
If StringStripWS($sBody, 3) = "" Then SetError(2, 0, 0)
If StringStripWS($sTo, 3) = "" And StringStripWS($sCc, 3) = "" And StringStripWS($sBCc, 3) = "" Then SetError(3, 0, 0)
; Access the default outbox folder
Local $aFolder = _OL_FolderAccess($oOL, "", $olFolderDrafts)
If @error Then Return SetError(@error + 1000, @extended, 0)
ConsoleWrite('+ _OL_FolderAccess OK' & @CRLF)
; Create a mail item in the default folder
Local $oItem = _OL_ItemCreate($oOL, $olMailItem, $aFolder[1], "", "Subject=" & $sSubject, "BodyFormat=" & $iBodyFormat, "Importance=" & $iImportance)
If @error Then Return SetError(@error + 2000, @extended, 0)
ConsoleWrite('+ _OL_ItemCreate OK' & @CRLF)
; Set the body according to $iBodyFormat
If $iBodyFormat = $olFormatHTML Then
_OL_ItemModify($oOL, $oItem, Default, "HTMLBody=" & $sBody)
Else
_OL_ItemModify($oOL, $oItem, Default, "Body=" & $sBody)
EndIf
If @error Then Return SetError(@error + 3000, @extended, 0)
ConsoleWrite('+ _OL_ItemModify OK' & @CRLF)
; Add recipients (to, cc and bcc)
Local $aRecipients
If $sTo <> "" Then
$aRecipients = StringSplit($sTo, ";", 2)
_OL_ItemRecipientAdd($oOL, $oItem, Default, $olTo, $aRecipients)
If @error Then Return SetError(@error + 4000, @extended, 0)
ConsoleWrite('+ _OL_ItemRecipientAdd $sTo OK' & @CRLF)
EndIf
If $sCc <> "" Then
$aRecipients = StringSplit($sCc, ";", 2)
_OL_ItemRecipientAdd($oOL, $oItem, Default, $olCC, $aRecipients)
If @error Then Return SetError(@error + 4000, @extended, 0)
ConsoleWrite('+ _OL_ItemRecipientAdd $sCc OK' & @CRLF)
EndIf
If $sBCc <> "" Then
$aRecipients = StringSplit($sBCc, ";", 2)
_OL_ItemRecipientAdd($oOL, $oItem, Default, $olBCC, $aRecipients)
If @error Then Return SetError(@error + 4000, @extended, 0)
ConsoleWrite('+ _OL_ItemRecipientAdd $sBCc OK' & @CRLF)
EndIf
; Add attachments
If $sAttachments <> "" Then
Local $aAttachments = StringSplit($sAttachments, ";", 2)
_OL_ItemAttachmentAdd($oOL, $oItem, Default, $aAttachments)
If @error Then Return SetError(@error + 5000, @extended, 0)
ConsoleWrite('+ _OL_ItemAttachmentAdd $sAttachments OK' & @CRLF)
EndIf
; Send mail
_OL_ItemSend($oOL, $oItem, Default)
If @error Then Return SetError(@error + 6000, @extended, 0)
ConsoleWrite('+ _OL_ItemSend OK' & @CRLF)
Return $oItem
EndFunc ;==>__OL_Wrapper_SendMail
Alles anzeigen
Die Ausgabe sollte dann so aussehen, wenn kein Fehler aufgetreten ist:
+ _OL_FolderAccess OK
+ _OL_ItemCreate OK
+ _OL_ItemModify OK
+ _OL_ItemRecipientAdd $sTo OK
+ _OL_ItemSend OK