vba - Targeting an open outlook email for population (Outlook 2010) -
i've been trying improve "quality of life" follow-up email process in office userform+vba snippet, , i've hit roadblock in while i've been able create brand new email , format stuff .body, .attachments.add, .to, etc., haven't been able figure out how reply already-existing email, necessary part of follow-up process.
i saw this page gave solution c#/vb.net, , in using object browser found "application.activeexplorer" exists in vba well. i'm working with:
private sub btnsubmit_click() dim msg string dim objmsg outlook.mailitem set followup = objmsg.activeinspector.currentitem followup ' compose message msg = "good morning," & "<br />" & "<br />" msg = msg & "this follow-up request following outstanding subjectivities: " & "<br />" & "<br />" = 0 listbox1.listcount - 1 if listbox1.selected(i) counter = counter + 1 msg = msg & listbox1.list(i) & "<br />" else: if counter = 0 msg = msg & “nothing” end if next msg = msg & "<br />" & "if these not submitted within 3 days, notice of cancellation sent." & _ "please let know if have questions or concerns." & "<br />" & "<br />" .reply .htmlbody = msg ' .attachments.add (" ") unload subjectivitiesselection .display end end sub
the end goal populate response message user can append appropriate user signature , send off, nothing fancy or automated makes life little easier , working little faster. i've got other things address in project (example: hitting ok without selecting of predetermined factors probably still build email regardless) go on biggest obstacle in path.
i apologize if isn't standards or if there's missing/unclear, i'm yet novice looking direction; been learning go object explorer, msdn, , plain old searching. i'll try clarify whatever can if there's ambiguous.
thanks time.
use mailitem.reply method - returns newly created mailitem object. code above not make sense - objmsg variable not initialized , mailitem object not have activeinspector property, application object does. might want @ application.activeexplorer.selection collection: contain selected items in folder. application.activeinspector messages opened in active inspector.
Comments
Post a Comment