Outputting a report in pdf when e-mailing ? *5102008

J

J.Alladien

Dear All,
have 2 questions!

1.When e-mailing a report you can choose diff kind of formats,is it possible
to output the report also in pdf-format(which is curr not in list!)? At the
moment I have an "Adobe converter software " installed which outputs my
report to PDF!but it would be easier for me if it could be done through
access!

2.Can a "snapshot file" be viewed by everyone who has Windows XP?or do you
need to especially install software for this?

Thanks in advance!
 
J

J.Alladien

Arvin,

What I meant was when f.e. i create a macro with the sendobject function
there comes a field where you can choose OUTPUT FORMAT: you can choose btween
;RTF,TEXT FILES,HTML,SNAPSHOT ......is there a way to also include the PDF
format in this list? Because I downloaded the Lebans File , but I could not
achieve all of the above-mentioned or I am doing something wrong?

Regards
 
T

Tom Wickerath

Using the SendObject action in a macro, you are limited to the options that
Microsoft provided. You can call a function to generate a .pdf file from a
macro, but why bother with the macro in the first place; just use some VBA
code behind a command button to generate the .pdf file directly, which gets
saved into some pre-defined folder, such as C:\Temp, or some TempOutput
folder that is child to the folder that your application is in.

Using Stephen Lebans' ReportToPDF method will allow you to save the report
as a .pdf file in some type of temporary output folder, usually on your local
hard drive. Then use VBA code to create an e-mail message with this new .pdf
file attached. Arvin gave you one method. Take a look at this thread from
yesterday for another method:

http://www.microsoft.com/office/com...ovba&mid=adcd572b-2052-45c3-a197-5e37af6cf082

Regarding the use of macros....
In Access 2003 and all prior versions, one cannot trap for errors and handle
them gracefully when using macros. Any errors that occur will cause a really
ugly macro error dialog to be presented to your users. The newest version of
Access, Access 2007 allows for error trapping, so macros are more appropriate
to consider using for Access applications created with Access 2007.

Consider the following quote:

From: "Inside Relational Databases, 2nd Edition, by Mark Whitehorn and Bill
Marklyn, published by Springer, p 151

"Macros offer the next level down, extending the functionality of the GUI.
Macros are still limited, however, and do not provide anything like the
enormous flexibility of a programming language. Both the macro and the
programming languages take some effort to learn and, surprisingly, often
require relatively different skills; in other words, a good working knowledge
of macros may not make it much easier to convert to using the programming
language. Perhaps even more surprisingly, I do not believe that programming
is fundamentally more difficult to learn. Macros are easier to use but not by
orders of magnitude."

"If you are new to RDBMSs, I suggest (with as much deference as possible)
that you may well not be in a position to judge whether you need macros or
programming. In that case, my advice is clear. Unless you are sure that your
needs really are simple, don't bother learning to use macros. Once you find
that you need more than the GUI offers, go straight to the programming
language. In this way you avoid the pain of climbing one learning curve only
to discover that the view from the top is unsatisfactory and another climb
awaits you."


Good Luck,

Tom Wickerath
Microsoft Access MVP
http://www.accessmvp.com/TWickerath/
http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________
 
J

J.Alladien

Arvin,

The code works fine however I am used to working in OUTLOOK EXPRESS instead
of microsoft outlook ,when I run this code it starts up in microsoft
outlook,can you tell me if It can be changed that it starts up in OUTLOOK
EXPRESS instead!

Thanks in advance!
 
A

Arvin Meyer [MVP]

This may work for you, I haven't tested it. It uses simple MAPI (not OE) and
sends the message with an attachment:

------------------------------
Declare Function MAPISendDocuments Lib "MAPI32.DLL" (ByVal UIParam&, ByVal
DelimStr$, ByVal FilePaths$, ByVal FileNames$, ByVal Reserved&) As Long

Public Sub SendDocs(ByVal hParent As Long, strFiles As String)
Dim hRes As Long
Dim strDelim As String * 16
Dim strNames As String * 16
Dim lngReserved As Long

strDelim = ";" & vbNullChar
strNames = String$(16, vbNullChar)
lngReserved = 0&
hRes = MAPISendDocuments(hParent, strDelim, strFiles, strNames,
lngReserved)
End Sub

Example usage:
SendDocs Me.Hwnd, "c:\My Documents\file1.zip; c:\file2.zip"
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com
 
J

J.Alladien

Dear Arvin,

I don't understand this code ,and the thing is that the proces I wanted to
do I am able to do now with following code(which you gave me):

Private Sub Command0_Click()
'Arvin Meyer 03/12/1999
'Updated 7/21/2001
On Error GoTo Error_Handler

Dim objOutlook As Outlook.Application
Dim objEmail As Outlook.MailItem

Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(olMailItem)

With objEmail
.To = "(e-mail address removed)"
.Subject = "Look at this sample attachment"
.body = "The body doesn't matter, just the attachment"
.Attachments.Add "C:\Test.htm"
'.attachments.Add "c:\Path\to\the\next\file.txt"
.Send
'.ReadReceiptRequested
End With

Exit_Here:
Set objOutlook = Nothing
Exit Sub

Error_Handler:
MsgBox Err & ": " & Err.Description
Resume Exit_Here

End Sub

The only thing I want is to let the automation send an e-mail with attachmnt
in OUTLOOK EXPRESS instead of MICROSOFT OUTLOOK, do you know a code that does
the same thing or can you explain to me how I must modify above-mentioned
code to do so!
 
D

Douglas J. Steele

It's not possible to use Automation with Outlook Express.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)
 
J

J.Alladien

Ok,

But why when I use the send object method the mail opens up in Outlook
Express ,please explain!
 
D

Douglas J. Steele

SendObject isn't Automation. Automation involves instantiating an instance
of the application (what the "Set objOutlook =
CreateObject("Outlook.application")" line in Arvin's code is doing) and then
working with that instantiation.

SendObject uses the default mail handler and goes from there. Because it's
generic, you can't do any advanced things with it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top