Why can’t I use the Outlook macro macro marked as read and move the mail item?

I have an Outlook macro marked as read and move all the messages in the conversation to another folder. I assign the macro to a button called “Archive”. However, I cannot “undelete” this action. If I

>delete the message
>archive the message
>undo

I eventually undelete the message. I thought I would cancel the move message. If I move the message by dragging and dropping it to another folder, the undo works the way I expect. This is a macro, does anyone know why this does not support undo?

Sub ArchiveConversation()
Set ArchiveFolder = Application.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox).Parent.Folders("Archive")
Set Conversations = ActiveExplorer.Selection.GetSelection(Outlook.OlSelectionContents.olConversationHeaders)
For Each Header In Conversations
Set Items = Header.GetItems()
For i = 1 To Items.Count< br /> Items(i).UnRead = False
Items(i).Move ArchiveFolder
Next i
Next Header
End Sub

Or I must Encode in withdrawal support?

Unfortunately, Outlook’s undo function only affects the user’s operation, not the program This operation works. Excel allows the Application.OnUndo hook, but this is not implemented in Outlook.

Perhaps a reasonable choice is to create an’undo previous Archive’ button; as long as you store the last archive operation where you can access it, when the user clicks the “Undo” button, your macro will manually move back the message and mark it as unread (if it was originally like this ).

I have an Outlook macro marked as read and move all messages in the conversation to another folder. I assign the macro to a folder named “Archive” button. However, I cannot “undo” this action. If I

>delete the message
>archive the message
>undo

I ended up undeleting the message. I thought I would cancel moving the message. If I move the message by dragging and dropping it to another folder, the undo works the way I expect. This is a macro, does anyone know why this is not supported Revoke?

Sub ArchiveConversation()
Set ArchiveFolder = Application.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox).Parent.Folders("Archive")
Set Conversations = ActiveExplorer.Selection.GetSelection(Outlook.OlSelectionContents.olConversationHeaders)
For Each Header In Conversations
Set Items = Header.GetItems()
For i = 1 To Items.Count< br /> Items(i).UnRead = False
Items(i).Move ArchiveFolder
Next i
Next Header
End Sub

Or I must Encode in withdrawal support?

Unfortunately, Outlook’s undo function only works on user operations, not programmatic operations. Excel allows you to use Application .OnUndo hook, but this is not implemented in Outlook.

Perhaps a reasonable option is to create an’undo previous archive’ button; as long as you store the last archive operation Where it can be accessed, when the user clicks the “Undo” button, your macro will manually move back the message and mark it as unread (if it was originally this way).

Leave a Comment

Your email address will not be published.