Ich habe mich jetzt stundenlang durch Google gewühlt, aber ich finde einfach keine funktionierende Lösung.
per Makro in Excel öffne ich ein neues Mailfenster. Dieses soll (auch wenn es nicht die Outlook-Voreinstellung des Users ist) die Haken bei "Verschlüsseln" und Signieren" gesetzt haben. Alternativ würde es auch reichen, wenn der User beim Versuch, die Mail ohne die gesetzten Haken zu senden, eine Fehlermeldung bekommt.
Das hier funktioniert nicht. oDigSignCtl.State wird zwar als 0 erkannt, aber oDigSignCtl.Execute bewirkt nichts. (Den Wert 719 habe ich ausgelesen, es ist "Nachricht digital signieren" in CommandBar: Attach)
Code
Function Item_Send(item)
Dim oDigSignCtl
Dim oCBs
Set oDigSignCtl = item.GetInspector.CommandBars.FindControl(, 719)
If oDigSignCtl Is Nothing Then
' Add the toolbar button to the item.
Set oCBs = item.GetInspector.CommandBars
Set oDigSignCtl = oCBs.item("Standard").Controls.Add(, 719, , , True)
End If
' Check to make sure the button is not dimmed.
If oDigSignCtl.Enabled = True Then
' Check to make sure the button is not depressed.
If oDigSignCtl.State = 0 Then
MsgBox "oDigSignCtl.State = 0"
oDigSignCtl.Execute
ElseIf oDigSignCtl.State = 0 Then
MsgBox "oDigSignCtl.State = 1"
End If
Else
MsgBox "You do not have a digital signature! " & _
"This mail will not be sent."
' Cancel the send to only allow sending of signed mail.
Item_Send = False
Exit Function
End If
Set oCBs = Nothing
Set oDigSignCtl = Nothing
End Function
Sub SendDigiMail()
Dim olApp As New Outlook.Application
Dim olMsg As Outlook.MailItem
Dim retVal
Set olMsg = olApp.CreateItem(olMailItem)
With olMsg
retVal = Item_Send(olMsg)
.Display
End With
End Sub
Display More
Bitte kein Spott über MS... ich brauch das beruflich