Hello everyone,
So I am creating a project management tool for my company. The way to create a project involves entering data into a UserForm. Two of the form inputs that I currently am looking at are called "txtAssignedTo" and "txtAssignedBy". I currently have this macro running once the user submits the form:
Sub NewProjectEmailMacro()
'Email workbook to specified users
Dim wb1 As Workbook
Dim OutApp As Object
Dim OutMail As Object
With Application
.ScreenUpdating = False
.EnableEvents = False
End With
Set wb1 = ActiveWorkbook
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.To = ""
.CC = ""
.BCC = ""
.Subject = "A New Project has been Created"
.Body = "A new project in the Project Tracker has been created. Please advise."
.Attachments.Add ActiveWorkbook.FullName
.Send
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
With Application
.ScreenUpdating = True
.EnableEvents = True
End With
End Sub
Currently, I am only able to know how to input specific email addresses into the "To" section of the macro. What I am looking to do is somehow be able to input the user values of "txtAssignedTo" and "txtAssignedBy" into the "To" section to send an email to only those two people. Also, I believe I will need to concatenate the final part of the email address (@yahoo.com for example will not be included in the form).
Any help is greatly appreciated and thank you as always!
Bookmarks