vba - Get Manager Email and add to the TO -
how manager email (the person employee reporting "outlook properties>organization") automatically add in code?
the code works if hardcode manager email want apply different departments managers different.
' sending copy of email supervisor dim oapp outlook.application dim omail mailitem set oapp = createobject("outlook.application") set omail = oapp.createitem(olmailitem) omail.body = "please review below email sent employee division" _ & vbcrlf & _ "**********************************************************" _ & vbcrlf & _ item.body omail.subject = item.subject & " (email revision)" omail.to = **((manager's email))** omail.send set omail = nothing set oapp = nothing
try application.currentuser.addressentry.getexchangeuser().manager.
be prepared handle getexchangeuser , manager returning null.
Comments
Post a Comment