473,386 Members | 1,803 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

E-mail report as excel to people on report

Hi All, i am succesfully e-mailing a report as an excel attachment with
a macro from a form that reflects people that are behind with there work
but i have to manually type in thier e-mail addressess, however i would
like to automate this so that the responsible people can automatically
be detected and the e-mail with attachment must be sent to them.

I hope i have made this clear enough.

I am not a programmer, but a dabbler, so an explanation with the code
would be appreciated.

Thanks in Advance

Tempy

*** Sent via Developersdex http://www.developersdex.com ***
Nov 13 '05 #1
2 1348
Br
Tempy <an*******@devdex.com> wrote:
Hi All, i am succesfully e-mailing a report as an excel attachment
with a macro from a form that reflects people that are behind with
there work but i have to manually type in thier e-mail addressess,
however i would like to automate this so that the responsible people
can automatically be detected and the e-mail with attachment must be
sent to them.

I hope i have made this clear enough.

I am not a programmer, but a dabbler, so an explanation with the code
would be appreciated.

Thanks in Advance

Tempy


You used the word needed "automated" :) You need to use automation to
create a new Outlook email (not sure how to do it with other mail
clients).

Do a search for "Outlook automation" ?
--
regards,

Bradley

A Christian Response
http://www.pastornet.net.au/response
Nov 13 '05 #2
Here's an example you can use. Note that I added MS Outlook to the
project references, but you can probably modify the code to use late
binding to avoid this. Note also that recent versions of MS Outlook
contain tremendous amounts of security that will cause prompts to
appear while the code is running.

Bill E.
Hollywood, FL

Function CreateEmail(ByVal objOutlook As Outlook.Application, ByVal
strRecipient As String, ByVal strSubject As String, ByVal strBody As
String, Optional strAttachment As String)
On Error GoTo Trapper
Dim objMailItem As Outlook.MailItem
Dim objRecipient As Outlook.Recipient

'Set the folder
Dim objFolder As Object
Set objFolder =
objOutlook.GetNamespace("MAPI").GetDefaultFolder(o lFolderOutbox)

'Create a new e-mail message
Set objMailItem = objOutlook.CreateItem(olMailItem)
With objMailItem
Set objRecipient = .Recipients.Add(strRecipient)
objRecipient.Type = olTo
.Subject = strSubject
.HTMLBody = strBody 'Use .Body if you are creating a text
message only
If strAttachment <> "" Then
.Attachments.Add strAttachment
End If
.Save
objMailItem.Move objFolder
End With

'Remove object references
Set objRecipient = Nothing
Set objMailItem = Nothing
Exit Function
Trapper:
MsgBox Err.Description
Exit Function

End Function

Sub Test
Dim strReport, strSubject as String

'Create the outlook instance
Dim objOL As Outlook.Application
Set objOL = CreateObject("outlook.application")

'Loop through the recordset and create a receipt for each employee
Dim objRS As ADODB.Recordset
Set objRS= 'Create your recordset here

With objRS
Do Until .EOF
strReport = 'Add your content here. It can be in HTML
if you like.
strSubject= 'Add your message subject here

'Create an e-mail message
strTo = .Fields("Firstname") & " " &
..Fields("LastName") & "<" & .Fields("Email") & ">"
CreateEmail objOL, strTo, strSubject, strReport
.MoveNext
Loop
End With

Set objRS = Nothing
Set objOL = Nothing

End Sub

Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Steven Stewart | last post by:
I have a user who has been using Excel for a while to keep statistics and print reports. She finds using it cumbersome because of long formulas and a lot of copying and pasting. I have designed...
3
by: Pecanfan | last post by:
Hi, I've got an access report which contains a sub-report. The sub-report contains various items in a group Footer which culminates in a running sum text box called txtGrandTotal. I want to...
3
by: okan | last post by:
Hi everyone. Is it possible that send same email to multiple people in table/form anyone with the same draft. 1.Private Sub Command20_Click() 2.Dim body As String 3.body="hello all" 4.If...
0
by: r0ckster | last post by:
Hi! I have an asp application that is using crystal report 10/crystal report viewer to view reports on the web. This app works well in windows 2k but when i migrated the code to xp, the error...
0
by: kishorebarik26 | last post by:
Dear reader, I need a way by which I can call one report from another report in Crystal Report or in Rdlc Report in VB.net 2005. Two report will not interlinked any way, so I cannot use Subreport...
2
by: domka | last post by:
hello, I making xml to excel report using by php. I sow problem and can't fix it. when i use loop like this for ($i=1; $i<5; $i++){ echo"<Row><Cell ss:StyleID=\"s52\"><Data...
1
by: Sport Girl | last post by:
Hi everybody , i have the task of developing in Perl a script that retrieves data from 3 tables ( bugs, profiles, products) from a MySQL database called bugs and display them in an excel sheet...
1
by: =?Utf-8?B?S3VtYXIuQS5QLlA=?= | last post by:
I am using Excel automation for a report. Dim objExcel As New Excel.Application objExcel.DisplayAlerts = False Dim objWorkbooks As Excel.Workbooks = objExcel.Workbooks Dim objWorkbook As...
1
by: dzgreek | last post by:
I use VB6 and for the first time its Data Report designer - I am using it without a data environment and I set my reports datasource property within my code. All I ever get is this error message...
0
by: kaybaj | last post by:
Please i want my report to display "Print Ribbon" when the report is in 'Report View mode' it only shows when the report is in "Print Preview mode" what can i do
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.