Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel-Send Email Macro 1

Status
Not open for further replies.

DrMingle

Technical User
May 24, 2009
116
US
There are a two email contacts that get this report. One is static and the other changes depedning on the outcome. I am trying to reference cell 'Master Appraisal'!F1 to send the report to the email contact which can change.

Any help would be appreciated...

Code:
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.Name
    wb.SendMail "'Master Appraisal'!F1", _
                ActiveWorkbook.Name

    On Error GoTo 0
End Sub
 



Hi,
Code:
wb.SendMail Sheets("Master Appraisal").Range("F1"), _
                ActiveWorkbook.Name

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top