View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default using rons email but need just printrange to mail

Working OK here but use the exact macro I posted and see if it give you the msgbox

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"pswanie" wrote in message ...



Sub Mail_Sheet_Outlook_Body()
' Don't forget to copy the function RangetoHTML in the module.
'thanx to Ron 4 this macro
' Working in Office 2000-2007
Dim rng As Range
Dim OutApp As Object
Dim OutMail 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("sheet1").UsedRange
Set rng = Range(ActiveSheet.PageSetup.PrintArea)



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

On Error Resume Next
With OutMail
.to = "
'.CC = ""
'.BCC = ""
.Subject = "Fault description log sent:" & " " & Format(Date, "dddd
dd/mm/yyyy") & " " & Format(Now, "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

Sheets("Sheet1").PrintOut



End Sub