views:

43

answers:

0

Hi There, I have some vb code that brings up an e-mail when a user closes the workbook. I was wondering if there is something i can do to stop the user from closing the e-mail @ the x in top right coner and on file memnu, please find code below....

Private Sub Workbook_BeforeClose(Cancel As Boolean)

repdate = Format(Date, "ddmmyyyy")

Set oOLook = CreateObject("Outlook.Application")
oOLook.Session.Logon
Set oEMail = oOLook.CreateItem(0)
oEMail.Display

    On Error Resume Next
    With oEMail

   .To = "[email protected]"
   .CC = ""
   .BCC = ""
   .Subject = "Test - " + repdate + " "
   .Body = "All, " & Chr(10) & Chr(10) & _
            "Test ." & Chr(10) & _
            "Point 1 =" & Chr(10) & _
            "Point 2 =" & Chr(10) & _
            "Point 3 =" & Chr(10) & _
            "Point 4 =" & Chr(10) & _
            "Point 5 =" & Chr(10) & Chr(10) & _
            "Kind Regards"
   End With
   On Error GoTo 0
End Sub

Hope you can help, Many thanks Mike Foster