Hey there, Below is a snippet of code that I use to send email from my userforms for a variety of functions. And I use this code in hundreds of userforms and macros.
During a corporate audit this morning the question was asked of me of who will be maintaining the code in a few years when I retire. And I will admit I was stumped, but it got me thinking that maybe I should at least start planning for that. So I am wondering if there is a way that in the case of the email addresses, perhaps I can reference a couple of cells on a worksheet somewhere. That way whomever is in charge of keeping the workbook running, instead of adjusting the code; all they would have to do is to type in the new names onto the worksheet. Does that make sense? Not sure how I would do that though... Maybe there is a better way? I appreciate any input - thanks
During a corporate audit this morning the question was asked of me of who will be maintaining the code in a few years when I retire. And I will admit I was stumped, but it got me thinking that maybe I should at least start planning for that. So I am wondering if there is a way that in the case of the email addresses, perhaps I can reference a couple of cells on a worksheet somewhere. That way whomever is in charge of keeping the workbook running, instead of adjusting the code; all they would have to do is to type in the new names onto the worksheet. Does that make sense? Not sure how I would do that though... Maybe there is a better way? I appreciate any input - thanks
Code:
' Show the envelope on the ActiveWorkbook.
ActiveWorkbook.EnvelopeVisible = True
With ActiveSheet.MailEnvelope
.Introduction = " The following facility inspection has been completed. "
.Item.To = "name1@company email;name2@company email"
.Item.Subject = "Facility Inspection Completed"
.Item.Send
End With