View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Corey Corey is offline
external usenet poster
 
Posts: 172
Default Sending ONLY Range or Page x, BUT not entire Activesheet, How ?

Thnaks again Norman, but i cannot get ONLY a range of cells to email instead
of the whole activesheet.

Code current below:

Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem
Application.ScreenUpdating = False
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(olMailItem)
With OutMail
.To = ThisWorkbook.Sheets("Sheet1").Range("B53").Value ' address in
sheet
.CC = ThisWorkbook.Sheets("Sheet1").Range("E53").Value ' cc
address in sheet
.BCC = ""
.Subject = ThisWorkbook.Sheets("Sheet1").Range("B55").Value '
subject line info in sheet
' .Body = bodyStr.("Sheet1").Range("B45:I107")
<----------------- Tried this to no avail also
.HTMLBody = SheetToHTML(ActiveSheet) '
<----------------- WANT TO SET THIS TO SEND IN BODY AS HTML ONLY
RANGE("B45:I107") NOT WHOLE SHEET
' .Attachments.Add () Add a file address here to add an attachment
later
.Display '.send to auto send without prompting
End With
Application.ScreenUpdating = True
Set OutMail = Nothing
Set OutApp = Nothing
End Sub


I looked at the 'Set source = Selection' but i could not get it to work
either.

Any idea's ?


Corey....
"Norman Jones" wrote in message
...
Hi Corey,

I can see the code there, but cannot still find the code to Select ONLY
cells say (B45:I107)

Is it there some where, as i cannot see any reference to cell ranges.


The suggested code includes the line:

Set source = Selection

Try changing Selection to your required range.


---
Regards,
Norman


"Corey" wrote in message
...
Thanks.
I can see the code there, but cannot still find the code to Select ONLY
cells say (B45:I107)

Is it there some where, as i cannot see any reference to cell ranges.

Corey....

"Norman Jones" wrote in message
...
Hi Corey,

See Ron de Bruin's example code at:

http://www.rondebruin.nl/mail/folder3/mail4.htm


---
Regards,
Norman


"Corey" wrote in message
...

I want to adapt this:
.HTMLBody = SheetToHTML(ActiveSheet)

How can i only have a selected range of cells, or a selected page sent
in the body of an email instaed of the entire sheet as it currently
does?
Any idea's ??

I want to send a range of ("A45:I107") or
Page 1


Corey....