N
Neil Holden
Hi all Gurus,
below is code to email the email address of cell l11 when a button is pressed.
What i would like it to do is place in the body of the email, text to say,
"PIP submission for Cell B11 and today's date."
Can someone please help!! : )
Sub Button29_Click()
Dim Response As String
Dim DefaultFolder As String, DefaultFileName As String
Dim FileToSave
Dim OutApp As Object 'this emails operations manager
Dim OutMail As Object
Dim strbody As String
Dim myRange As Range
'Dim OutApp As Object
'Dim OutMail As Object
Response = MsgBox("Are you sure you want to save the PIP report?", _
vbYesNo + vbInformation + vbDefaultButton2)
If Response = vbYes Then
strbody = "PIP" & " for " & Sheets("PIP").Range("A14").Value & " " & _
Sheets("PIP").Range("B13").Value & " " & "Ready For Review"
' Working in Office 2000-2010
With Application
.EnableEvents = False
.ScreenUpdating = False
End With
Set OutApp = CreateObject("Outlook.Application")
For Each ws In ActiveWorkbook.Worksheets
If ws.Range("L11").Value Like "?*@?*.?*" Then
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.To = ws.Range("L11").Value
.CC = ""
.BCC = ""
.Subject = "PIP Submission"
'.HTMLBody =
'RangetoHTML (ws.UsedRange)
'You can add a file like this
'.Attachments.Add ("C:\test.txt")
.Send 'or use .Display
End With
On Error GoTo 0
Set OutMail = Nothing
End If
Next ws
Set OutApp = Nothing
With Application
.EnableEvents = True
.ScreenUpdating = True
End With
End If
End Sub
below is code to email the email address of cell l11 when a button is pressed.
What i would like it to do is place in the body of the email, text to say,
"PIP submission for Cell B11 and today's date."
Can someone please help!! : )
Sub Button29_Click()
Dim Response As String
Dim DefaultFolder As String, DefaultFileName As String
Dim FileToSave
Dim OutApp As Object 'this emails operations manager
Dim OutMail As Object
Dim strbody As String
Dim myRange As Range
'Dim OutApp As Object
'Dim OutMail As Object
Response = MsgBox("Are you sure you want to save the PIP report?", _
vbYesNo + vbInformation + vbDefaultButton2)
If Response = vbYes Then
strbody = "PIP" & " for " & Sheets("PIP").Range("A14").Value & " " & _
Sheets("PIP").Range("B13").Value & " " & "Ready For Review"
' Working in Office 2000-2010
With Application
.EnableEvents = False
.ScreenUpdating = False
End With
Set OutApp = CreateObject("Outlook.Application")
For Each ws In ActiveWorkbook.Worksheets
If ws.Range("L11").Value Like "?*@?*.?*" Then
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.To = ws.Range("L11").Value
.CC = ""
.BCC = ""
.Subject = "PIP Submission"
'.HTMLBody =
'RangetoHTML (ws.UsedRange)
'You can add a file like this
'.Attachments.Add ("C:\test.txt")
.Send 'or use .Display
End With
On Error GoTo 0
Set OutMail = Nothing
End If
Next ws
Set OutApp = Nothing
With Application
.EnableEvents = True
.ScreenUpdating = True
End With
End If
End Sub