access to pdf

R

Roland Malo

Hi nice people
Many thanks Albert, your conversation with Neil on 12&13 Nov. about conversion Access report to PDF and mailed automatically was very helpful to me.
1 – the line Call ConvertReportToPdf (Str……) doesn’t work, return: function not defined, same for GetNameSpace
2 - I am fronting the same problem but on sending the report as a body of the email using outlook. Can’I put my PDF document in line
..Body = StrDocName

Any help

Roland


EggHeadCafe - .NET Developer Portal of Choice
http://www.eggheadcafe.com
 
A

Albert D. Kallal

I can recall, or see the original thread, but it likely don't matter.
1 – the line Call ConvertReportToPdf (Str……) doesn’t work, return:
function not defined, same for GetNameSpace

Did you download and install the code library from Stephens web site for
this?

you'll find the code to create the pdf here:

http://www.lebans.com/reporttopdf.htm

You likely should get the above sample working on your computer before you
attempt to move and copy that above code into your own application. (So get
his sample working first). Do note the above sample also requires that you
place the appropriate DLL files in the same folder as your application.

2 - I am fronting the same problem but on sending the report as a body of
the email using outlook. Can’I put my PDF document in line
.Body = StrDocName

The text body of an e-mail has absolutely no relationship, or has absolutely
nothing to do who with you making an attachment. Remember, if you use
Stephens pdf creator, then you can not use send object in MS access. (you
have to use outlook automation).

You will have to use outlook automation (and therefore this means the user
will have to be using a outlook, not outlook express for their e-mail
client).

So the whole approach here is that you're going to create a PDF a file that
is SAVED to disk. You then created the e-mail, and then set that pdf file as
an attachment.

The following code shows you how to start an outlook session, and then
attach a file of your choice to the e-mail.

So, *after* you create the pdf file, YOU then simply start a outlook
session, and attach the file you made using the pdf library.

eg:
dim strDocName as string
' send to user via email
'Dim ol As Outlook.Application
Dim ol As Object ' Late binding
'Dim ns As NameSpace
Dim ns As Object ' Late bind
'Dim newmessage As MailItem
Dim newmessage As Object ' Late bind

Dim mymessage As String
'Dim objOutlookAttach As Outlook.Attachment
'Dim objOutlookAttach As Object

strDocname = "c:\mydata\Report.pdf"

Set ol = GetObject(, "Outlook.Application")
Set ns = ol.GetNamespace("MAPI")
ns.Logon
Set newmessage = ol.CreateItem(0) ' 0 = olMainItem
With newmessage
.Recipients.Add strEmailTo
.Subject = strSubject
.Body = strMsgText
'Set objOutlookAttach = .Attachments.Add(stDocName)
.Attachments.Add (strDocName)
.Display
' .Send
End With
 

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