Hi All,

I have a script that either sends or displays several emails, however, when testing additions to the script, I would like to declare one variable to return .Send or .Display, to avoid having to change several sections from .Send to .Display.

I've tried

Sub WIPEmail()

Dim rng As Range
Dim OutApp As Object
Dim OutMail As Object
Dim SendDisp As Action

SendDisp = .display

With Application
    .EnableEvents = False
    .ScreenUpdating = False
End With

Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)

With OutMail
    '.to = "Temp Email"
    .Subject = "Test - " & FormatDateTime(c, 1)
    .HTMLBody = "Test," & "<br><br>" & _
    SendDisp
End With

With Application
    .EnableEvents = True
    .ScreenUpdating = True
End With

Set OutMail = Nothing
Set OutApp = Nothing

End Sub
Any advice would be greatly appreciated

Many thanks