form auto email question

vanwhyjr

New Member
Joined
Oct 23, 2023
Messages
7
Office Version
  1. 365
Platform
  1. Windows
Hello Everyone,

New to the forum.
I have been asked by the boss to set up a sheet that has a list of our active jobs. One of the columns will have the customers email and one will have a column with a drag down list (In-process, on hold, complete).
I would like the spreadsheet to automatically send a customer survey to the email in the row that is changed to complete.
Is that something possible with a Macro? I have some basic macro knowledge. Not real good with the VBA code.

Thank you for any recommendations.

The nube!
George V.
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
That is certainly possible. Is the customer survey in a separate file? If so, what is the name of the file and what is the full path to the folder where it is saved?
 
Upvote 0
Yes the survey is a separate file. It would be located on one of our share drives.
 
Upvote 0
In which column are the customers emails and in which column are the drop down lists?
 
Upvote 0
Copy and paste this macro into the worksheet code module. Do the following: right click the tab name for your sheet and click 'View Code'. Paste the macro into the empty code window that opens up. Please note the text in red. Close the code window to return to your sheet. Make a selection in the drop down list in column F.
Rich (BB code):
Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Column <> 6 Then Exit Sub
    Dim OutApp As Object, OutMail As Object, sPath As String
    If Target = "complete" Then
        sPath = "Enter full path to the file here."
        Set OutApp = CreateObject("Outlook.Application")
        Set OutMail = OutApp.CreateItem(0)
        With OutMail
            .To = Range("B" & Target.Row)
            .Subject = "Enter subject line here."
            .HTMLBody = "Enter body of email here."
            .attachments.Add sPath
            .Display
        End With
    End If
    Application.ScreenUpdating = True
End Sub
 
Upvote 0
Solution
Sweet, That works. If I change "Display" to make it send automatically?
 
Upvote 0
I can't get it to auto send. If I get rid of display and add .Send it goes to debug.
 
Upvote 0
When you click "Debug", what is the error message and which line of code is highlighted?
 
Upvote 0

Forum statistics

Threads
1,215,201
Messages
6,123,617
Members
449,109
Latest member
Sebas8956

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top