Hi there
Yes, it is possible to send an email via Gmail from Excel based on a condition in a cell.
Here's an example VBA code that you can modify to fit your specific needs:
VBA Code:
Sub OpenEmail()
Dim EmailSubject As String
Dim SendTo As String
Dim EmailBody As String
Dim Mail_Object As Object
Dim Email_Send_To As String
Dim Email_Cc As String
Dim Email_Bcc As String
Dim Email_Attachment_Path As String
Dim myApp As Object
Dim myMail As Object
'Check if cell J3 in sheet9 equals "L"
If Sheets("sheet9").Range("J3").Value = "L" Then
'Email subject
EmailSubject = "Subject of your email"
'Email body
EmailBody = "This is the body of your email"
'Recipient email address
SendTo = "recipient@email.com"
'Create email object
Set myApp = CreateObject("Outlook.Application")
Set myMail = myApp.CreateItem(0)
'Set email properties
With myMail
.Subject = EmailSubject
.To = SendTo
.Body = EmailBody
End With
'Display email
myMail.Display
'Release email object from memory
Set myMail = Nothing
Set myApp = Nothing
End If
End Sub
In this example code, if cell J3 in sheet9 equals "L", an email will be sent to the specified recipient with the specified subject and body. You will need to modify the values of the EmailSubject, SendTo, and EmailBody variables to match your specific needs.