Im trying to send it to 2 people.
This is my code:
Sub Clear_Click()
Range("A7:B56").ClearContents
Range("D7:D56").ClearContents
End Sub
Sub SendeMail()
Dim sendTo(2) As String
Dim msg, sendSub As String
Application.ScreenUpdating = False
msg = "Pl. pick your clinic before clicking on this button!!"
If ActiveSheet.Cells(2, 2) = "Pl. pick your clinic" Then
MsgBox msg
Exit Sub
End If
msg = "Pl. enter a new PO# before clicking on this button!!"
If ActiveSheet.Cells(2, 4) = "Pl. enter a new PO#" Then
MsgBox msg
Exit Sub
End If
sendTo(0) = "courtney@me.com"
sendTo(1) = "courtney@me.ca"
sendSub = "Clinic: " & Worksheets("Purchase Order").Cells(2, 2) & _
" PO#: " & Worksheets("Purchase Order").Cells(2, 4) & _
" Dated: " & Format(Cells(3, 4).Value, "dd-mmm-yy")
'Add a worksheet
Worksheets.Add After:=Sheets(Sheets.Count)
'Copy the data from Purchase Order
Worksheets("Purchase Order").Activate
Worksheets("Purchase Order").Range("A1:D60").Copy
Worksheets(Sheets.Count).Activate
'Paste formats and values
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Selection.Columns.AutoFit
Range("A1").Select
'Create a new Workbook Containing the active Sheet
ActiveSheet.Copy
Application.CutCopyMode = False
'Delete the buttons
For Each shp In ActiveSheet.Shapes
shp.Delete
Next
With ActiveWorkbook
'Send as an attachment by eMail
.SendMail Recipients:=sendTo, _
Subject:=sendSub
'Don't save changes
.Close SaveChanges:=False
End With
Application.DisplayAlerts = False
Worksheets(Sheets.Count).Delete
Application.DisplayAlerts = True
Worksheets("Purchase Order").Activate
Application.ScreenUpdating = True
End Sub
Bookmarks