VBA Help Email that will save as draft and send as attachment

Status
Not open for further replies.

BlackOps

Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server 2010
Hi people. Would need some help with vba in outlook.
Currently i have a macro that detect emails send to external and will do a prompt that ask if the email is checked. Would want to work on having the vba script to check on the email sent and in a prompt, ask the user if he want to send it as an attachment for his supervisor to check, if yes, the email will be save as draft and forwarded out, else the email will not be sent.
Best case would be if the script can detect if there is an attachment, if yes, ask if he would like to forward to his supervisor to check, if not, no action taken. Also if there is no attachment, it will check if this email is send to external, if yes, does a prompt if email check, if yes proceed to send.
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
You'd start with the macro at Check for missing attachments before sending a message - it shows how to check for attachments. (Remove the first If and last End if, change .count = 0 to .count > 0)
Do something like this in the cancel line (that should send as forward, not forward a draft tho - will need to create a new item and attach the draft) -
If answer = vbNo Then Cancel = True
fw = item.forward
fw.to = "boss@domain.com"
fw.send
End If
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
This works... but the recipient needs to use Resend Message to send it (at least my test recipient did.) It's in the sent folder as a draft attached to the message.

Code:
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
        If Item.Attachments.Count > 0 Then
          answer = MsgBox("Do you want to send this for approval?", vbYesNo)
          If answer = vbYes Then Cancel = True
          Item.Save
          Set fw = Application.CreateItem(olMailItem)
            fw.To = "boss@domain.com"
            fw.Subject = "Needs Approved"
            fw.Attachments.Add Item
            fw.Send
Item.Delete
        End If
End Sub
 

BlackOps

Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server 2010
Great help Diane. This is the code i am looking for.
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
R Help Revising VBA macro to delete email over different time span Outlook VBA and Custom Forms 0
M Help sending email but removing signature via VBA Outlook VBA and Custom Forms 5
S Outlook Email Help: Select custom voting button options VBA Outlook VBA and Custom Forms 1
S Email Help: Sending Outlook email from Excel VBA Outlook VBA and Custom Forms 6
J Help Please!!! Outlook 2016 - VBA Macro for replying with attachment in meeting invite Outlook VBA and Custom Forms 9
S VBA Macro - Run-time error '424': object required - Help Please Outlook VBA and Custom Forms 3
J Need Help with Contacts VBA Outlook VBA and Custom Forms 1
A Help with VBA please! Outlook VBA and Custom Forms 15
G Message template / custom forms and VBA Help needed - inserting info into table Outlook VBA and Custom Forms 3
M VBA SWcript Help Required Using Outlook 1
R [VBA] complicated(?) outlook events - need help with code Using Outlook 15
R VBA Macro to VBScript in a form- Help Please! Using Outlook 10
F No Attachment Warning - VBA Code HELP Outlook VBA and Custom Forms 1
C Beginner Needs VBA Help in Modifying Code Outlook VBA and Custom Forms 2
P VBA help window: Multiple windows/tabs, bookmarks, bookmarks/historypane Outlook VBA and Custom Forms 4
S Add VBA save code Using Outlook 0
C Auto Run VBA Code on new email Outlook VBA and Custom Forms 1
O VBA Cases with Listbox - Can you use Multi-Select? Outlook VBA and Custom Forms 4
O VBA Outlook Message Attachment - Array Index Out of Bounds Outlook VBA and Custom Forms 0
V Modifying the built in forms with VBA Outlook VBA and Custom Forms 4
S Excel VBA and shared calendar issue Outlook VBA and Custom Forms 4
L Macro/VBA to Reply All, with the original attachments Outlook VBA and Custom Forms 2
L VBA unknown character Outlook VBA and Custom Forms 2
G Move tasks up/down todo list by VBA Outlook VBA and Custom Forms 1
diver864 vba for a rule to automatically accept meeting requests with 'vacation' in subject, change to all-day event, change to free, don't send reply Outlook VBA and Custom Forms 1
K Use VBA to find Sender and Recipient from Microsfot 365 Journaled Email Items Outlook VBA and Custom Forms 3
J Want to learn VBA Macros for Outlook. What book can you recommend? Outlook VBA and Custom Forms 2
F VBA code to dock Styles whenever I write or edit an email Outlook VBA and Custom Forms 0
C VBA to prompt for Sent folder destination Outlook VBA and Custom Forms 3
B Adding signature to bottom of VBA reply email Outlook VBA and Custom Forms 1
B Change Font and Font size using VBA Outlook VBA and Custom Forms 9
M Outlook 2013 reminder email by using Outlook vba Outlook VBA and Custom Forms 2
D.Moore VBA script fail after Office 365 update Using Outlook 8
R Limiting length of saved attachment in VBA Outlook VBA and Custom Forms 2
S Skype for business meeting vba code Outlook VBA and Custom Forms 1
C How to use VBA to show only items x days old or more Outlook VBA and Custom Forms 1
B VBA to convert email to task, insert text of email in task notes, and attach copy of original email Outlook VBA and Custom Forms 4
D Outlook VBA error extracting property data from GetRules collection Outlook VBA and Custom Forms 10
S Reference Custom Fields with VBA Outlook VBA and Custom Forms 2
PGSystemTester VBA To Change AppointmentItem.BusyStatus From MeetingItem Before Send Using Outlook 0
A VBA macro for 15 second loop in send and received just for 1 specific mailbox Outlook VBA and Custom Forms 1
O Email not leaving Outbox when using Excel VBA to sync Outlook account Outlook VBA and Custom Forms 4
G VBA Macro Calendar Printing Assistant 4
B VBA to Collapse Task Folder Groups Outlook VBA and Custom Forms 1
R Expand VBA Permanent Delete Code Outlook VBA and Custom Forms 6
shrydvd vba to secure zip attachments Outlook VBA and Custom Forms 3
M Adding Subject to this Link-Saving VBA Outlook VBA and Custom Forms 5
N VBA to delete duplicates by message-id on common pst for 2 or more emails Outlook VBA and Custom Forms 0
S Change VBA script to send HTML email instead of text Outlook VBA and Custom Forms 3
M VBA to auto forward message with new subject and body text Outlook VBA and Custom Forms 8

Similar threads

Top