1

I'm working on Visual Basic for Applications code for Outlook to reply to emails that have been moved to a folder called "Reply".

I have it set up a rule to look at the folder when running. Is there a way to modify this code to look at a specific folder?

Option Explicit
Sub ReplyMSG()
    Dim olItem As Outlook.MailItem
    Dim olReply As MailItem ' Reply
    
    For Each olItem In Application.ActiveExplorer.Selection
        Set olReply = olItem.ReplyAll
        olReply.HTMLBody = "Hi and thanks for the email" & vbCrLf & olReply.HTMLBody
        olReply.Display
    
        olReply.Send
    Next olItem
End Sub
karel
  • 5,489
  • 46
  • 45
  • 50
  • 1
    this question is about VBA, not VBScript. That is a different language (although it has a similar syntax) – Geert Bellekens Oct 21 '21 at 07:19
  • Hi niton, tried you comment in the url you sent at getting error Run Time Error 424 Object required is there a specific place in my script where I need to put in "Set objFolder = objFolder.Folders("Inbox").Folders("mySubFolder1")" – Peacescript Oct 29 '21 at 08:02
  • All good got it to work :0) thx – Peacescript Nov 01 '21 at 14:42

0 Answers0