473,807 Members | 2,884 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

E-mailing a Report in HTML

Is there a way to skip the format selection when e-mailing reports?
Maybe in the VB coding? I want them to always be sent in an HTML
format.
Any information is helpful. Thanks.

Nov 17 '06 #1
7 1996
microsoft access wrote:
Is there a way to skip the format selection when e-mailing reports?
Maybe in the VB coding? I want them to always be sent in an HTML
format.
Any information is helpful. Thanks.
Are you using SendObject? If so...
DoCmd.SendObjec t acReport, "ReportName ", acFormatHTML, strTo, strCC,
strBCC, "SubjectLin e", "BodyText", False
Nov 18 '06 #2


On Nov 18, 4:40 am, salad <o...@vinegar.c omwrote:
microsoft access wrote:
Is there a way to skip the format selection when e-mailing reports?
Maybe in the VB coding? I want them to always be sent in an HTML
format.
Any information is helpful. Thanks.Are you using SendObject? If so...
DoCmd.SendObjec t acReport, "ReportName ", acFormatHTML, strTo, strCC,
strBCC, "SubjectLin e", "BodyText", False
Yep. That was exactly what I needed. Thanks a lot!

Nov 18 '06 #3
MLH
Salad, I find that acFormatHTML performance is marginal
at best in reproducing HTML facsimiles of Access 97 reports.
So I've taken the liberty of creating the desired HTML string
(very long string) in code, concatenating everything to meet
my own specs.

What I'm missing is how to feed that VLS to the SendObject
method as an attachment to the eMail. Knowing my luck, the
approach I'm taking won't work. But I can't seem to find sufficient
documentation on how to build a template file for the SendObject
method to use to even take a stab at using a template.

Do you know how I can have the SendObject method attach my
own HTML rather than the canned procedure it's using?
Nov 19 '06 #4
microsoft access wrote:
Is there a way to skip the format selection when e-mailing reports?
Maybe in the VB coding? I want them to always be sent in an HTML
format.
Any information is helpful. Thanks.
If you have Windows 2000 or later this sends a report in HTML. It has
been tested in Northwind. Some lines may have been split by news
clients; they will have to be put back together. I think this does not
use any modern functions from this century but I have not tested for
that.

Public Sub SendReportasHTM L( _
ByVal ReportName As String, _
ByVal SMTPServer As String, _
ByVal SendUserName As String, _
ByVal SendPassword As String, _
ByVal SendEmailAddres s As String, _
ByVal Subject As String, _
ByVal Recipients As String, _
Optional ByVal NumberofPagesAl lowed As Long = 10)

Dim Buffer As String
Dim Position As Long
Dim FileNumber As Integer
Dim HTML As String
Dim HTMLFullPath As String
Dim iCfg As Object
Dim iMsg As Object
Dim Skelton As String
Dim TempDirectory As String
Dim Truncate As Long

Set iCfg = CreateObject("C DO.Configuratio n")
Set iMsg = CreateObject("C DO.Message")

TempDirectory = Environ$("temp" )
If Len(TempDirecto ry) = 0 Then TempDirectory = CurDir$()
TempDirectory = TempDirectory & "\"
Skelton = Format(Now(), "mmmddyyyyhhnns s")
HTMLFullPath = TempDirectory & Skelton & ".html"

DoCmd.OutputTo acOutputReport, ReportName, acFormatHTML, HTMLFullPath

HTMLFullPath = Dir$(TempDirect ory & Skelton & "*.html")
While Len(HTMLFullPat h) <0 And NumberofPagesAl lowed <0
HTMLFullPath = TempDirectory & HTMLFullPath
FileNumber = FreeFile()
Open HTMLFullPath For Binary As #FileNumber
Buffer = String(LOF(File Number), vbNullChar)
Get #FileNumber, , Buffer
Close #FileNumber
Position = InStr(Buffer, "</TABLE>")
While Position <0
Truncate = Position
Position = InStr(Truncate + 1, Buffer, "</TABLE>")
Wend
HTML = HTML & Left(Buffer, Truncate + 7)
HTML = HTML & "<hr>"
Kill HTMLFullPath
HTMLFullPath = Dir$()
NumberofPagesAl lowed = NumberofPagesAl lowed - 1
Wend

If Len(HTMLFullPat h) <0 And NumberofPagesAl lowed = 0 Then _
HTML = HTML & "<br><b>Par tial Report: Additional Pages not Shown"

With iCfg.Fields
..Item("http://schemas.microso ft.com/cdo/configuration/sendusing") = 2
..Item("http://schemas.microso ft.com/cdo/configuration/smtpserverport" )
= 25
..Item("http://schemas.microso ft.com/cdo/configuration/smtpserver") =
SMTPServer
..Item("http://schemas.microso ft.com/cdo/configuration/smtpauthenticat e")
= 1
..Item("http://schemas.microso ft.com/cdo/configuration/sendusername") =
SendUserName
..Item("http://schemas.microso ft.com/cdo/configuration/sendpassword") =
SendPassword
..Item("http://schemas.microso ft.com/cdo/configuration/sendemailaddres s")
= SendEmailAddres s
..Update
End With
With iMsg
..Configuration = iCfg
..Subject = Subject
..To = Recipients
..HTMLBody = HTML
..Send
End With

SendReportAsHTM LExit:
Close
Set iMsg = Nothing
Set iCfg = Nothing
Exit Sub

SendReportAsHTM LErr:
With Err
MsgBox .Description, vbCritical, "Error " & .Number
End With
Resume SendReportAsHTM LExit

End Sub
Private Sub TestSendReportA sHTML()
SendReportasHTM L "Products By Category", "smtp.domain.co m",
"fi*******@doma in.com", "password", "First Last
<fi*******@doma in.com>", "Testing SendReportAsHTM L",
"re*******@doma in.com"
End Sub

Nov 19 '06 #5
MLH
Looking at your early 2001 post here
http://groups.google.com/group/comp....e=UTF-8&rnum=4

What mods would be necessary to the code you posted (shown below)
to enable specifying and sending of an HTML file or any attachment for
that matter?

Option Explicit

Type MAPIRecip
Reserved As Long
RecipClass As Long
Name As String
Address As String
EIDSize As Long
EntryID As String
End Type

Type MAPIFileTag
Reserved As Long
TagLength As Long
Tag() As Byte
EncodingLength As Long
Encoding() As Byte
End Type

Type MAPIFile
Reserved As Long
Flags As Long
Position As Long
PathName As String
FileName As String
FileType As Long
End Type

Type MAPIMessage
Reserved As Long
Subject As String
NoteText As String
MessageType As String
DateReceived As String
ConversationID As String
Originator As Long
Flags As Long
RecipCount As Long
Recipients As Long
Files As Long
FileCount As Long
End Type

Declare Function MAPISendMail _
Lib "c:\program files\outlook express\msoe.dl l" ( _
ByVal Session As Long, _
ByVal UIParam As Long, _
message As MAPIMessage, _
ByVal Flags As Long, _
ByVal Reserved As Long) As Long

Sub SendMailWithOE( ByVal strSubject As String, ByVal strMessage As
String, ByRef
aRecips As Variant)
Dim recips() As MAPIRecip
Dim message As MAPIMessage
Dim z As Long
ReDim recips(LBound(a Recips) To UBound(aRecips) )
For z = LBound(aRecips) To UBound(aRecips)
With recips(z)
.RecipClass = 1
If InStr(aRecips(z ), "@") <0 Then
.Address = StrConv(aRecips (z), vbFromUnicode)
Else
.Name = StrConv(aRecips (z), vbFromUnicode)
End If
End With
Next z
With message
.NoteText = strMessage
.Subject = strSubject
.RecipCount = UBound(recips) - LBound(aRecips) + 1
.Recipients = VarPtr(recips(L Bound(recips)))
End With
MAPISendMail 0, 0, message, 0, 0
End Sub

Sub TestSendMailwit hOE()
Dim aRecips(0 To 0) As String
aRecips(0) = "smtp:t...@sysp ac.com"
SendMailWithOE "Send Mail Through OE", "Sure, you can, Tom!",
aRecips
End Sub
Nov 19 '06 #6
MLH
Oops... I see your answer posted at
http://ffdba.com/downloads/Send_Mail...ok_Express.htm
Sorry. Didn't read far enough, I guess.
Nov 19 '06 #7
MLH wrote:
Salad, I find that acFormatHTML performance is marginal
at best in reproducing HTML facsimiles of Access 97 reports.
So I've taken the liberty of creating the desired HTML string
(very long string) in code, concatenating everything to meet
my own specs.

What I'm missing is how to feed that VLS to the SendObject
method as an attachment to the eMail. Knowing my luck, the
approach I'm taking won't work. But I can't seem to find sufficient
documentation on how to build a template file for the SendObject
method to use to even take a stab at using a template.

Do you know how I can have the SendObject method attach my
own HTML rather than the canned procedure it's using?
Not with SendObject.

You could put the string as the body.

Using Open/Close/Write/Put etc you should be able to write the file to
an HTML file. But to attach you could create an instance of Outlook and
attach the file. On Google Groups (search for Outlook and Attachments
for Group "*Access*") and at Tony Toews site
http://www.granite.ab.ca/access/email.htm you'll find some code to
assist you.

I send out attachments all the time with Outlook and Groupwise. I
create a bunch of PDFs, get other files necessary, and attach the bunch
to the email.

I am hoping, but not expecting, MS to have a better handle on e-mails in
the upcoming version of Access. But MS may keep it as a "roll-your-own"
topic.
Nov 19 '06 #8

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

Similar topics

1
1078
by: Fabiano | last post by:
Please, we are going to start a new system and i have a doubt at with technology may i use to create reports. May i use SQL Reporting, Crystal Reports or create manually at HTML. My app will just run over SQL Server database. Tks in adv.
5
2669
by: adrian.williams2 | last post by:
Hi, I'm having trouble trying to email a report via access... I get a Outlook message stating 'a program is trying to automatically send e-mail on your behalf. Do you want allow this? This report will be emailed in the early hours of the morning when no users are around to click 'Yes!'Is there a way to prevent this from happening, so the report gets emailed without user interaction?
1
1062
by: Steven Bazeley | last post by:
Is this possible in VB.NET using System.Web.Mail ? What is the best way to programmatically read HTML syntax into a string variable so it can be loaded programmatically into the body of an email and sent?
1
5320
by: David Templet | last post by:
I have a C# application that generates its reports in HTML. After it creates the report, it opens it in IE so it can be viewed or printed. I would like to add the ability to print the report directly from the application, but I haven't found an easy way to do this. I am probably making it overly complicated, but this is what I am doing right now: 1. Instance an "AxWebBrowser" control 2. Navigate the browser control to the report HTML...
0
1568
by: Bill Nguyen | last post by:
Please forgive me for cross posting. I hope I can get the answer from either NG. I was able to export a CR report to PDF to MAPI (using Outlook client) , but not with HTML format from a .NET application. In Brian Bischof's book, he warns about the file folder that created by CR during export to HTML format. I don't know whether this is the case but all parameters were set to false, meaning it's a simple export to HTML format.
2
1345
by: djsdaddy | last post by:
Good Day to All, I am organizing some Affirmative Action data and I need to be able to sum a number of field totals and then print them in a report. I have 5 tables that store the data that I need for this report: 1) tblMasterEmployee - relates the next 3 tables by EmployeeID 2) tblEmployeeDates - need Date of Hire and Termination Date (if applicable) 3) tblEEO-Promotions - Keeps track of employee promotions 4) tblEEO-EmployeeData -...
20
1928
by: paul814 | last post by:
I've been working on this for some time now and have gotten nowhere...hoping someone here can help. I want to take and email all records in a database for the current date when this php page is run. Now I have a number of tables in this database...looking like this: editorial editorialdate, editorialname, editorialcomments press
4
1733
by: Nick | last post by:
I have a critical requirement where I need to club together 4 xml files and display them in an sibngle HTML report. The xmls are generated by Java application by a normal file I/O. Is there a way I can club them together in a presentable format for reporting purpose ? So for .g. a.xml, b.xml, c.xml and d.xml. These xmls I want to display in an html report say report.html in a 4 columns in java.
1
2609
by: didacticone | last post by:
i have a database where i am trying to email a report as an attachment, it works fine but since it is an .rtf file the conversion is messy... i was wondering if i can do it as a pdf or some other easily read file... any help is greatly appreciated. thanks.. here is my current code.. and also some info on the report is populated by the current record i am on in the form... On Error GoTo cmdEMailReport_Click_Err Dim strMsg As String,...
0
9720
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10372
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10374
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10112
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9193
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7650
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5685
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3854
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3011
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.