Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

Pb d'exécution de macro pour faire afficher une fenêtre "envoyer et classer

1 réponse
Avatar
caro2010
Bonjour,

Hier j'ai lu sur votre forum un message qui expliquait comment faire apparaître dans Outlook, au moment d'envoyer un message, une fenêtre pour classer l'e-mail au lieu qu'il aille automatiquement dans "Eléments envoyés". Hier j'ai suivi la procédure et cela fonctionnait très bien et aujourd'hui cela ne fonctionne plus.
J'ai l'impression que la macro ne s'excute tout simplement pas. Comment la réactiver?

Voici ce que j'ai fait :
ALT+F11 puis dans "thisoutlooksession" j'ai collé :
Private Sub Application_ItemSend(ByVal Item As Object, _
Cancel As Boolean)
Dim objNS As NameSpace
Dim objFolder As MAPIFolder
Set objNS = Application.GetNamespace("MAPI")
Set objFolder = objNS.PickFolder
If TypeName(objFolder) <> "Nothing" And _
IsInDefaultStore(objFolder) Then
Set Item.SaveSentMessageFolder = objFolder
End If
Set objFolder = Nothing
Set objNS = Nothing
End Sub

Public Function IsInDefaultStore(objOL As Object) As Boolean
Dim objApp As Outlook.Application
Dim objNS As Outlook.NameSpace
Dim objInbox As Outlook.MAPIFolder
On Error Resume Next
Set objApp = CreateObject("Outlook.Application")
Set objNS = objApp.GetNamespace("MAPI")
Set objInbox = objNS.GetDefaultFolder(olFolderInbox)
Select Case objOL.Class
Case olFolder
If objOL.StoreID = objInbox.StoreID Then
IsInDefaultStore = True
End If
Case olAppointment, olContact, olDistributionList, _
olJournal, olMail, olNote, olPost, olTask
If objOL.Parent.StoreID = objInbox.StoreID Then
IsInDefaultStore = True
End If
Case Else
MsgBox "This function isn't designed to work " & _
"with " & TypeName(objOL) & _
" items and will return False.", _
, "IsInDefaultStore"
End Select
Set objApp = Nothing
Set objNS = Nothing
Set objInbox = Nothing
End Function

1 réponse

Avatar
Geo
Bonjour Caro

[...]
J'ai l'impression que la macro ne s'excute tout simplement pas. Comment la
réactiver?



déjà si avec Alt+F11 l'éditeur s'ouvre c'est bon signe, sinon il
faudrait aller voir dans "?" éléments désactivés.

Le truc pour savoir si une macro s'exécute, c'est d'ajouter un
debug.print et voir si quelque chose est écrit dans la fenêtre
d'exécution.
Par exemple :

Private Sub Application_ItemSend(ByVal Item As Object, _
Cancel As Boolean)
Dim objNS As NameSpace
Dim objFolder As MAPIFolder

Debug.print "Passage dans Application_ItemSend"

--
A+