Hi all,
I have some code that has been chopped up a little. As far as i can see the code should work, please could someone explain why it does not work?
The code does fire when a new email arrives i have proved that, so i think there is a fault with the forward/send part.
[VBA]Private WithEvents Items As Outlook.Items
Private Sub Application_Startup()
Dim objNS As Outlook.NameSpace
Set objNS = GetNamespace("MAPI")
Set Items = objNS.GetDefaultFolder(olFolderInbox).Items
End Sub
Private Sub Items_ItemAdd(ByVal item As Object)
Dim Msg As Outlook.MailItem
Dim NewForward As Outlook.MailItem
If item.Class = olMail Then
If Left$(item.Subject, 1) = "1" Then
Set Msg = item
Set NewForward = Msg.Forward
With NewForward
.Subject = "Hi"
.To = "example@example.com"
.HTMLBody = "Hi again"
'.Send
.Display
End With
End If
End If
Set NewForward = Nothing
Set Msg = Nothing
End Sub[/VBA]
Thanks for looking