0% found this document useful (0 votes)
19 views

Update by Extendoffice 2018

This VBA code contains a Worksheet_Change event that triggers if cell D7 is changed to a number less than 10. If this condition is met, it will call the Mail_small_Text_Outlook subroutine. This subroutine sets up an Outlook email with the subject "Avertizare" and body containing two lines of text. It will display the email for the user to send or send it directly.

Uploaded by

Grigoras Mihai
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views

Update by Extendoffice 2018

This VBA code contains a Worksheet_Change event that triggers if cell D7 is changed to a number less than 10. If this condition is met, it will call the Mail_small_Text_Outlook subroutine. This subroutine sets up an Outlook email with the subject "Avertizare" and body containing two lines of text. It will display the email for the user to send or send it directly.

Uploaded by

Grigoras Mihai
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

'Update by Extendoffice 2018/3/7

Private Sub Worksheet_Change(ByVal Target As Range)

On Error Resume Next

If Target.Cells.Count > 1 Then Exit Sub

Set xRg = Intersect(Range("D7"), Target)

If xRg Is Nothing Then Exit Sub

If IsNumeric(Target.Value) And Target.Value < 10 Then

Call Mail_small_Text_Outlook

End If

End Sub

Sub Mail_small_Text_Outlook()

Dim xOutApp As Object

Dim xOutMail As Object

Dim xMailBody As String

Set xOutApp = CreateObject("Outlook.Application")

Set xOutMail = xOutApp.CreateItem(0)

xMailBody = "Hi there" & vbNewLine & vbNewLine & _

"This is line 1" & vbNewLine & _

"This is line 2"

On Error Resume Next

With xOutMail

.To = "[email protected]"

.CC = "[email protected]"

.BCC = ""

.Subject = "Avertizare "

.Body = xMailBody

.Display 'or use .Send

End With

On Error GoTo 0

Set xOutMail = Nothing

Set xOutApp = Nothing

End Sub

You might also like