excel prompt macro function Save_Exit() not found ?
Sub Workbook_Open()
' Don't forget to copy the function RangetoHTML in the module.
' Working in Office 2000-2007
Dim rng As Range
Dim OutApp As Object
Dim OutMail As Object
Dim SafeItem As Object
With Application
.EnableEvents = False
.ScreenUpdating = False
End With
Set rng = Nothing
Set rng = ActiveSheet.UsedRange
'You can also use a sheet name
'Set rng = Sheets("YourSheet").UsedRange
Set OutApp = CreateObject("Outlook.Application")
Set SafeItem = CreateObject("Redemption.SafeMailItem") 'Create an instance of Redemption.SafeMailItem
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)
SafeItem.Item = OutMail 'set Item property
SafeItem.Recipients.Add "ongkokl@psa.com.sg"
SafeItem.Recipients.ResolveAll
On Error Resume Next
With SafeItem
.To = "ongkokl@psa.com.sg"
.CC = ""
.BCC = ""
.Subject = "BT Direct Disc " & Format(Now, "dd-mmm-yy hh:mm")
.HTMLBody = RangetoHTML(rng)
.Send 'or use .Display
End With
On Error GoTo 0
With Application
.EnableEvents = True
.ScreenUpdating = True
End With
Set OutMail = Nothing
Set OutApp = Nothing
Application.OnTime Now + TimeValue("00:0:05"), "Save_Exit"
End Sub
Sub Save_Exit()
Application.Quit
ThisWorkbook.Close SaveChanges:=True
End Sub
Bookmarks