Forward Outlook emails using VBA Script

I need to create one vba script that can forward emails I receive. The only problem is that the emails I’d like to forward have different subjects,only the beginning is the same. This is how far I’ve gotten with it(this should be inserted in ThisOutlookSession). Someone could help me please?

Public WithEvents objInbox As Outlook.Folder
Public WithEvents objInboxItems As Outlook.Items
Private Sub Application_Startup()
    Set objInbox = Outlook.Application.Session.GetDefaultFolder(olFolderInbox)
    Set objInboxItems = objInbox.Items
End Sub

Private Sub objInboxItems_ItemAdd(ByVal item As Object)
    Dim objMail As Outlook.MailItem
    Dim objForward As Outlook.MailItem

    If TypeOf item Is MailItem Then
      Set objMail = item

      'If it is a specific new email
      If (objMail.Subject = "Offer Response Received") Then
     
   

          Set objForward = objMail.Forward
          'Customize the forward subject, body and recipients
          With objForward
                .Subject = "Offer Response Received"
                .HTMLBody = "<HTML><BODY>Please proceed. </BODY></HTML>" & objForward.HTMLBody
                .Recipients.Add ("XY")
                .Recipients.Add ("XY")
                .Recipients.ResolveAll
                .Importance = olImportanceHigh
                .Send
          End With
      End If
    End If
End Sub

First of all, don’t use multiple dots in the single line of code. I’d recommend breaking the chain of calls and declare each property or method call on separate lines of code.

If objFolder.DefaultItemType = olMailItem Then

There is no need to check out the folder’s property in the loop each time. I’d suggest moving that condition out of the loop.

objitem.BodyFormat = olFormatHTML

Why do you need to set up the BodyFormat property? Did have a chance to check the value before setting the property?

myforward.Body = Replace(myforward.Body, "xxnamexx", "FirstName", 1, 1)

The Body property is a string representing the clear-text body of the Outlook item. You need to use the HTMLBody property if you want to preserve the formatting. You can read more about all possible ways of working with item bodies in the Chapter 17: Working with Item Bodies.

Anyway, I don’t see the code where you add images and other information to the message body.