Emailing selected cell range using outlook

Solved/Closed
suryam - Apr 28, 2011 at 03:37 PM
RWomanizer Posts 365 Registration date Monday February 7, 2011 Status Contributor Last seen September 30, 2013 - May 2, 2011 at 12:39 AM
Hello,

Hi, I have one task. I need to email some of my invoices that I prepare on a daily basis. I have a .xls file with some work sheets. I have one sheet with the name "Invoice" which contains an invoice template in the range B6:F52. Invoice work sheet has some other useful info also.
To email the cell range ....what I am doing now is just selecting the range and using "paste " button in the Home tab of the ribbon --and then "copy as picture when printed" and then pasting it on to the MS word. later I am sending it as PDF attachment. Is it possible to email "selected range of cells of my xls worksheet" directly from my workbook using MS Outlook express. you can refer my sample file which is located at
http://wikisend.com/download/602234/sales report model.xls
once again my question is I need to email(using outlook ) a "selected range of cells B6:F52" of my work sheet....Here one thing,,,my work sheet might contain other info also. I donot want to email everything that is there on my worksheet or workbook.
pls help. bye suryam



Related:

7 responses

RWomanizer Posts 365 Registration date Monday February 7, 2011 Status Contributor Last seen September 30, 2013 120
Apr 29, 2011 at 01:35 AM
which version of MS Word you are using?
0
Hi, I am using MS word 2007 and MS Outlook express 6.
thanks
cheers
suryam
0
RWomanizer Posts 365 Registration date Monday February 7, 2011 Status Contributor Last seen September 30, 2013 120
Apr 29, 2011 at 02:03 AM
Hi Suryam,

Here is the code:

the code work as follows:

it select the invoice range which you given,
import the file to pdf and save it.
now create a mail and attach the file.
than save it to draft.

Note: Change subject line and massage body as according to you.

Sub PdfMail() 
Dim OutApp, OutMail As Object 
Dim Inv As Long 
Dim MItem As Object 
Dim Fname As String 

Sheets("INVOICE").Select 
Inv = Mid(Range("f17"), 9, 4) 
Fname = "D:\" & Inv & ".pdf" 
Range("B6:F52").Select 
    Selection.ExportAsFixedFormat Type:=xlTypePDF, Filename:=Fname, _ 
        Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _ 
        :=False, OpenAfterPublish:=False 

Set OutApp = CreateObject("Outlook.Application") 
OutApp.Session.Logon 
Set OutMail = OutApp.CreateItem(0) 
On Error Resume Next 
' Create Mail Item and send it 

With OutMail 
.To = "" 
.Subject = "Invoice Details"        ' CHANGE SUBJECT LINE HERE 
' CHANGE MSG HERE 
.Body = "Hey boss," & vbNewLine & vbNewLine & "Heres the PDF file you wanted." _ 
        & vbNewLine & vbNewLine & "Regards," & vbNewLine & "Rahul" 
.Attachments.Add Fname 
.Save 'to Drafts folder 
End With 
Set OutlookApp = Nothing 
Kill Fname 

End Sub 


Cheers, :)
Rahul
0
Hi code looks good. Might work for me. But when I used it, it is "starting the MS outlook 2007" . I am using MS Outlook express 6. To be frank with you , I donot know the difference between these two versions.
Here I want to make it clear that I don't want to distrub the connection settings which are already set on my computer...bcoz we have a shared network for 10 people. I donot want to be blamed by my office people for chainging the outlook express 6 settings. Can you pls settle my issue without going to MS outlook 2007? or suggest me something else so that my purpose is met. ok thanks for your cooperation
bye suryam
0

Didn't find the answer you are looking for?

Ask a question
RWomanizer Posts 365 Registration date Monday February 7, 2011 Status Contributor Last seen September 30, 2013 120
Apr 29, 2011 at 04:27 AM
Hi Suryam,

As outlook express is not a part of MS office,

sorry i am not fully aware that how to map with outlook express, even i don't have outlook express in my system so i can experiment something.

may some other expert in the form help you regarding this or you can use google search, if successed please paste the code in this form so any other user take benefits of this.

Till than you can use the code upto the save the pdf and manually attach it with your mail.

Sub PdfMail() 
Dim Inv As Long 
Dim Fname As String 

Sheets("INVOICE").Select 
Inv = Mid(Range("f17"), 9, 4) 
Fname = "D:\" & Inv & ".pdf" 
Range("B6:F52").Select 
    Selection.ExportAsFixedFormat Type:=xlTypePDF, Filename:=Fname, _ 
        Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _ 
        :=False, OpenAfterPublish:=False 

End Sub 



Regards,
Rahul
0
Hi Rahul , thanks very much for your great help. your code best suited to my purpose. I am extremely happy. I have some other new questions also... will be in touch with you soon thru this forum. thanks again...I cannot forget your help....cheers.. bye suryam
0
RWomanizer Posts 365 Registration date Monday February 7, 2011 Status Contributor Last seen September 30, 2013 120
May 2, 2011 at 12:39 AM
You are most welcome with your queries in this forum.
0