I want to be able to use the exact feature in Excel for send receipent (with attachment): --> I don't want to have a predefined email address in the macro...I want the TO: field to be empty. I will be assigning this macro to a button within the current spread sheet.
The end goal is to get the activeworksheet as an attachment in an email with the subject line being the same as the activeworksheet and the TO: field is to remain empty.
Below is the code I currently have:
Sub Mail_workbook_1()
Dim wb As Workbook
Set wb = ActiveWorkbook
If Val(Application.Version) >= 12 Then
If wb.FileFormat = 51 And wb.HasVBProject = True Then
MsgBox "There is VBA code in this xlsx file, there will" & vbNewLine & _
"be no VBA code in the file you send. Save the" & vbNewLine & _
"file first as xlsm and then try the macro again.", vbInformation
Exit Sub
End If
End If
On Error Resume Next
wb.SendMail "drmingle@example.com", _
"ActiveWorkbook"
On Error GoTo 0
End Sub
The end goal is to get the activeworksheet as an attachment in an email with the subject line being the same as the activeworksheet and the TO: field is to remain empty.
Below is the code I currently have:
Sub Mail_workbook_1()
Dim wb As Workbook
Set wb = ActiveWorkbook
If Val(Application.Version) >= 12 Then
If wb.FileFormat = 51 And wb.HasVBProject = True Then
MsgBox "There is VBA code in this xlsx file, there will" & vbNewLine & _
"be no VBA code in the file you send. Save the" & vbNewLine & _
"file first as xlsm and then try the macro again.", vbInformation
Exit Sub
End If
End If
On Error Resume Next
wb.SendMail "drmingle@example.com", _
"ActiveWorkbook"
On Error GoTo 0
End Sub