Forward outlook mails with excel VBA
Hi,
Thank you very much for the support. I could not able to forward the mail but succeed to read the content and paste in another mail and then send to the mail id. I manage to find this code from Ms office help but can't execute it successfully, showing an error message "Run time error 438 Object doesn't support this property or method" at line "Set myinspector = Application.ActiveInspector" in MS office 2007. Please help me to solve this problem and I think my purpose will be solved manipulating the below formula.
Thanks.
Code:
Sub RemoveAttachmentBeforeForwarding()
Dim myinspector As Outlook.Inspector
Dim myItem As Outlook.MailItem
Dim myattachments As Outlook.Attachments
Set myinspector = Application.ActiveInspector
If Not TypeName(myinspector) = "Nothing" Then
Set myItem = myinspector.CurrentItem.Forward
Set myattachments = myItem.Attachments
While myattachments.Count > 0
myattachments.Remove 1
Wend
myItem.Display
myItem.Recipients.Add "Dan Wilson"
myItem.Send
Else
MsgBox "There is no active inspector."
End If
End Sub