Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 247
Default using rons email but need just printrange to mail

im using one of rons email macro's to mail the sheet.
i got my checkbox linked to k4. outside of the print range (when u go
printpreview)

but when i email it in the body of mail as html it includes all the data
even if i got it in white so it does not show on screen.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default using rons email but need just printrange to mail

Hi

Try this
Set rng = Range(ActiveSheet.PageSetup.PrintArea)


Sub Mail_Selection_Range_Outlook_Body()
' 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

Set rng = Nothing
On Error Resume Next
Set rng = Range(ActiveSheet.PageSetup.PrintArea)
On Error GoTo 0

If rng Is Nothing Then
MsgBox "The selection is not a range or the sheet is protected" & _
vbNewLine & "please correct and try again.", vbOKOnly
Exit Sub
End If

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

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

On Error Resume Next
With OutMail
.To = "
.CC = ""
.BCC = ""
.Subject = "This is the Subject line"
.HTMLBody = RangetoHTML(rng)
.display 'or use .Display
End With
On Error GoTo 0

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

Set OutMail = Nothing
Set OutApp = Nothing
End Sub



--

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


"pswanie" wrote in message ...
im using one of rons email macro's to mail the sheet.
i got my checkbox linked to k4. outside of the print range (when u go
printpreview)

but when i email it in the body of mail as html it includes all the data
even if i got it in white so it does not show on screen.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 247
Default using rons email but need just printrange to mail

just that one line that i need to add in and then ive " ' " the old line?

im getting a error

-----------------------------------------------------------------------------
method 'range' of object'_global' failed
-----------------------------------------------------------------------------
debug bring me to that line that i pasted in


"Ron de Bruin" wrote:

Hi

Try this
Set rng = Range(ActiveSheet.PageSetup.PrintArea)


Sub Mail_Selection_Range_Outlook_Body()
' 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

Set rng = Nothing
On Error Resume Next
Set rng = Range(ActiveSheet.PageSetup.PrintArea)
On Error GoTo 0

If rng Is Nothing Then
MsgBox "The selection is not a range or the sheet is protected" & _
vbNewLine & "please correct and try again.", vbOKOnly
Exit Sub
End If

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

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

On Error Resume Next
With OutMail
.To = "
.CC = ""
.BCC = ""
.Subject = "This is the Subject line"
.HTMLBody = RangetoHTML(rng)
.display 'or use .Display
End With
On Error GoTo 0

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

Set OutMail = Nothing
Set OutApp = Nothing
End Sub



--

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


"pswanie" wrote in message ...
im using one of rons email macro's to mail the sheet.
i got my checkbox linked to k4. outside of the print range (when u go
printpreview)

but when i email it in the body of mail as html it includes all the data
even if i got it in white so it does not show on screen.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default using rons email but need just printrange to mail

Show me the macro you use now



--

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


"pswanie" wrote in message ...
just that one line that i need to add in and then ive " ' " the old line?

im getting a error

-----------------------------------------------------------------------------
method 'range' of object'_global' failed
-----------------------------------------------------------------------------
debug bring me to that line that i pasted in


"Ron de Bruin" wrote:

Hi

Try this
Set rng = Range(ActiveSheet.PageSetup.PrintArea)


Sub Mail_Selection_Range_Outlook_Body()
' 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

Set rng = Nothing
On Error Resume Next
Set rng = Range(ActiveSheet.PageSetup.PrintArea)
On Error GoTo 0

If rng Is Nothing Then
MsgBox "The selection is not a range or the sheet is protected" & _
vbNewLine & "please correct and try again.", vbOKOnly
Exit Sub
End If

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

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

On Error Resume Next
With OutMail
.To = "
.CC = ""
.BCC = ""
.Subject = "This is the Subject line"
.HTMLBody = RangetoHTML(rng)
.display 'or use .Display
End With
On Error GoTo 0

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

Set OutMail = Nothing
Set OutApp = Nothing
End Sub



--

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


"pswanie" wrote in message ...
im using one of rons email macro's to mail the sheet.
i got my checkbox linked to k4. outside of the print range (when u go
printpreview)

but when i email it in the body of mail as html it includes all the data
even if i got it in white so it does not show on screen.


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 247
Default using rons email but need just printrange to mail




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


  #6   Report Post  
Posted to microsoft.public.excel.programming
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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I do a mail merge to email via excel Kris - Recruiter for Hospital Excel Discussion (Misc queries) 1 March 17th 08 12:30 PM
Mail to standard email adres question Excel Discussion (Misc queries) 1 December 10th 07 01:15 PM
help getting winzip code from RONs de bruin site funkymonkUK[_176_] Excel Programming 9 June 28th 06 11:11 PM
Printrange function help? Frigid_Digit Excel Programming 0 September 2nd 05 11:12 AM
Using macro to change printrange / fit-to-page Marco[_6_] Excel Programming 3 April 29th 04 04:05 PM


All times are GMT +1. The time now is 12:22 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"