I need help.
I have a spreadsheet that has multiple columns, 3 of which contain names, email addresses and a column for "confirmed". for simplicity call them A:C
I am trying to create a macro that will open a userform.
The form has two text boxes like an emial.
1. is labled subject
2. is labled body (side question...how do I allow for the "enter" key to be used in a text box to create more than 1 line?)
There are two cmd buttons
1. Cancel (obvioulsy if the user wants to exit without sending)
2. Send
Once the send button is clicked on......
It will take the values from the two text boxes and use them to send a bulk email to everyone on the list who has an email entered, but doesn't have an "X" in the confirmed column.
This is the code I have for the emial part
VB Code:
Sub Mail_small_Text_Outlook() 'You must add a reference to the Microsoft outlook Library Dim OutApp As Outlook.Application Dim OutMail As Outlook.MailItem Dim VarBody As String Dim VarSubj As String VarSubj = "Userform1.txtSubj.text" VarBody = "Userform1.txtBody.text" Do If ActiveCell <> "" And ActiveCell.Offset(0, 1) <> "X" Then Set OutApp = CreateObject("Outlook.Application") Set OutMail = OutApp.CreateItem(olMailItem) strbody = VarBody With OutMail .To = ActiveCell.Value .CC = "" .BCC = "" .Subject = VarSubj .Body = VarBody .Send 'or use .Display End With Set OutMail = Nothing Set OutApp = Nothing ActiveCell.Offset(0, 1) = "X" Else: ActiveCell.Offset(1, 0).Select End If Loop Until ActiveCell.Value = "send_email_end" End Sub
I need big help on the code for the userform.
Thanks so much




Reply With Quote