Hi All,
I am using the code from the post VBA Help Email that will save as draft and send as attachment
Below is my code. The problem is it works fine but i am not able to delete the email which gets saved in the draft? and i am planning to deploy this code to each of the users PC so how i can remove the hardcoded line of abc.com , instead it should read the value from somewhere dynamically. Any direction would certainly help.
I am using the code from the post VBA Help Email that will save as draft and send as attachment
Below is my code. The problem is it works fine but i am not able to delete the email which gets saved in the draft? and i am planning to deploy this code to each of the users PC so how i can remove the hardcoded line of abc.com , instead it should read the value from somewhere dynamically. Any direction would certainly help.
Code:
Public Sub Initialize_Handler()
Set Item = Application.ActiveInspector.CurrentItem
End Sub
Private Sub Item_Close(Cancel As Boolean)
answer = MsgBox("Do you want to send this for approval?", vbYesNo)
If answer = vbYes Then
Cancel = False
Item.save
Set fw = Application.CreateItem(olMailItem)
fw.To = "abc.com"
fw.Subject = "Needs Approval"
fw.Attachments.Add Item
fw.Send
Item.Delete ' Gives Error here
ElseIf answer = vbNo Then
Cancel = False
End If
End Sub