Forum Discussion
Amisha35
Sep 19, 2023Copper Contributor
Replay from excel - Any one ??
I just need my own code to search in shared mails also. I have this VBA code that look up from excel to outlook based on cell value it should find the thread and replay to latest mail. but the i...
Amisha35
Sep 20, 2023Copper Contributor
NikolinoDE
Sep 20, 2023Platinum Contributor
More information please about the digital environment. Excel version, operating system, storage medium, file extension, etc.
- Amisha35Sep 20, 2023Copper ContributorExcel 365, Windows, file extension is xlsm
- NikolinoDESep 20, 2023Platinum Contributor
Although you have not provided any precise information, here is a last attempt on my part. I have not tested the code, so please back up the file before making any changes.
Sub ReplyAllLastEmailFromAllFolders() Dim olApp As Outlook.Application Dim olNs As Namespace Dim objMail As Object Dim objReplyToThisMail As MailItem Dim objConversation As Conversation Dim objTable As Table Dim objVar As Variant Dim strBody As String Dim searchValue As String ' Set your search value based on the cell value searchValue = ActiveCell.Value Set olApp = New Outlook.Application Set olNs = olApp.GetNamespace("MAPI") ' Loop through all folders, including subfolders For Each objFolder In olNs.Folders ProcessFolder objFolder, searchValue ' Pass searchValue as a String Next objFolder Set olApp = Nothing Set olNs = Nothing Set objMail = Nothing Set objReplyToThisMail = Nothing Set objConversation = Nothing Set objTable = Nothing If IsArray(objVar) Then Erase objVar End SubHope it helps you!