Recently, I forgot to send attachments to emails. I wrote a VBA applet to check the attachments. If the title (subject) contains a specific string, such as the leave request requested by the Company, time Sheet will check and prompt. It feels quite helpful. The code and steps are as follows.
- Open Outlook
- Alt + F11 enter code editing mode
- Add the code to the thisoutlooksession module and save it.
The code for the image is as follows:
Private sub application_itemsend (byval item as object, cancel as Boolean) 'pops up a reminder if the word "attach? ± Is found but there is no attachment on your email. dim M as variantdim strbody as stringdim intin as longdim intattachcount as integer, intstandardattachcount as integerdim strtitle as stringdim arrlen as integer 'title check text checkstr = array ("Leave request ", "expense sheet", "timesheet", "Time Sheet", "Attach") dim hasatt as booleanon error goto handleerrorintstandardattachcount = 1' for title checkst Rtitle = lcase (item. subject) arrlen = ubound (checkstr) for I = 0 to arrlen intin = instr (1, strtitle, checkstr (I )) if intin> 0 then hasatt = true intin = 0 next I if hasatt = true then M = msgbox ("You forgot the attachment again! "& Vbcrlf &" there is no attachment to this message. "& vbcrlf &" Do you still want to send? ", Vbquestion + vbyesno + vbmsgboxsetforeground) If M = vbno then cancel = trueend ifhandleerror: If err. number <> 0 then msgbox "Outlook attachment reminder error:" & err. description, vbexclamation, "Outlook attachment reminder error" End ifend sub
You can also add other checks based on your needs.
Reference: http://www.businesshut.com/outlook-macros/outlook-attachment-reminder-macro.