I have two PC setups:
(everything original)
My question is, why same VBA code work in 2019 and didnt work in Outlook 2016. Problem is with Outlook or different version of build MS Win10 ?
This part of code didnt work:
ThisOutlookSession
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim objMailPuvodni As Outlook.MailItem
Dim CurrentItem As Object
Dim lngOdpoved As Long
Select Case TypeName(Application.ActiveWindow)
Case "Inspector"
Set objMailPuvodni = Application.ActiveInspector.CurrentItem
Case "Explorer"
If Application.ActiveExplorer.Selection.Item(1).Class = _
OlObjectClass.olMail Then
Set objMailPuvodni = _
Application.ActiveExplorer.Selection.Item(1)
End If
End Select
lngOdpoved = MsgBox("text", _
vbQuestion + vbYesNoCancel + vbDefaultButton2, _
"Send")
Select Case lngOdpoved
Case vbCancel
Cancel = True
Case vbNo
Cancel = False
Case vbYes
Call SifrovatZip(objMailPuvodni)
Cancel = True
End Select
Set objMailPuvodni = Nothing
End Sub
UPDATE @nilton answer works
@nilton's answer in the comments works:
Typically this is due to forgetting to allow macros Enable or disable macros in Office files when upgrading.