Can SendObject for PDF use acExportQualityPrint? (1 Viewer)

kingdoz

Registered User.
Local time
Today, 10:23
Joined
Dec 2, 2008
Messages
29
Hi Guys,

I use Access 2007. I cant seem to work out thge best way to make this code work. Two issues really.

Firstly if email2 or email3 do nat have any data, my code crashes, so need to rewrite it so that it still works even without email2 or email3 having data.

Secondly I dont seem to know if I can use acExportQualityPrint in this code somewhere so as to avoid a lossy PDF being sent. I know it can be put if you use in OpenReport, But i really want to send it rather than save it.

I attach the code below and would appreciate any tweaks to it if not too time consuming.
Thanks
Code:
Option Compare Database
'------------------------------------------------------------
' Proc_112221
'
'------------------------------------------------------------
Function Proc_112221()
On Error GoTo Proc_112221_Err
    With CodeContextObject
        DoCmd.GoToRecord , "", acNext
        DoCmd.GoToRecord , "", acPrevious
        DoCmd.OpenReport "InvoiceEmail", acViewPreview, "", "[Invoice No]=[Forms]![Invoices]![Invoice No]"
        DoCmd.SendObject acReport, "", "PDFFormat(*.pdf", .Email, .Email2, .Email3, "Hello", "Dear Sir Hello", True, ""
    End With
 
Proc_112221_Exit:
    Exit Function
Proc_112221_Err:
    MsgBox Error$
    Resume Proc_112221_Exit
End Function
 

vbaInet

AWF VIP
Local time
Today, 10:23
Joined
Jan 22, 2010
Messages
26,374
Firstly if email2 or email3 do nat have any data, my code crashes, so need to rewrite it so that it still works even without email2 or email3 having data.
Use Nz()
Code:
DoCmd.SendObject acReport, "", acFormatPDF, .Email, [COLOR=Red]Nz([/COLOR].Email2[COLOR=Red], "")[/COLOR], [COLOR=Red]Nz([/COLOR].Email3[COLOR=Red], "")[/COLOR], "Hello", "Dear Sir Hello", True, ""

Secondly I dont seem to know if I can use acExportQualityPrint in this code somewhere so as to avoid a lossy PDF being sent. I know it can be put if you use in OpenReport, But i really want to send it rather than save it.
If it doesn't exist in the parameters then it's not possible.
 

kingdoz

Registered User.
Local time
Today, 10:23
Joined
Dec 2, 2008
Messages
29
Thanks for the NZ method. That part works. Is there no way to send a high quality PDF by email? it seems by default Access optimises it for screen...
 

vbaInet

AWF VIP
Local time
Today, 10:23
Joined
Jan 22, 2010
Messages
26,374
You will be looking at automating it using the Outlook object or other e-mail object.
 

corai

Registered User.
Local time
Today, 10:23
Joined
Jun 10, 2011
Messages
24
How would one go about automating this process using an Outlook object?
 

kingdoz

Registered User.
Local time
Today, 10:23
Joined
Dec 2, 2008
Messages
29
I wish I knew, people before says its a good answer but I have spent te last 2 days trying to work this out :( I may have to find an access guru to do this job as I'm simply lost.
 

vbaInet

AWF VIP
Local time
Today, 10:23
Joined
Jan 22, 2010
Messages
26,374
It's not a straightforward process. But here are the steps:

1. Save the file to the hard disk in high quality
2. Send the file using the Outlook or some other method or commercial product
3. Delete the file from hard disk.

If you are going to send lots of different reports, it would be better to save all the e-mails you need to send first, then run the send to e-mail routine.

You may search the forum for ways of doing it via Outlook.
 

kingdoz

Registered User.
Local time
Today, 10:23
Joined
Dec 2, 2008
Messages
29
It' would be much better if Microsoft simply would allow non compressed PDFs as sendobject or allow a third party to do the pdf conversion as you simply cant send objects as pdfs with logos or images as not professional rnough. I can't get manage to get a routine to work in outlook as I'm not techie enough so i think I may give up and just send invoices with no branding out. It Needs to import lots of fields from access out into outlook with the PDF to fill in emails and cc emails and subject fields and name of attachment as email number so too much to get my head around. Just a stupid compression setting MS could have not put in to make it useful for access which is meant for less techies like me. Plus it needs to work on other people's machines so wanted to simply keep it all in access so outlook routine programming is out the question. I wonder if it the pdf conversion settings can either be hacked or if MS may give more options to that command in next version of access. Fingers crossed it does. If anyone hears of another solution please keep in touch.
Thanks guys.
 

JIK

New member
Local time
Today, 02:23
Joined
Jan 26, 2013
Messages
3
Hi all, sorry to resurrect an old thread but I am also looking for a way to use the sendObject cmd in Access WITH the acExportQualityPrint variant.

I'm using Access 2010 with the very good, now defunct-but-still-working PDF add-in for 2007 (in preference to buying Adobe sh!t and allowing them to seize my world).

It appears the old add-in uses the pdf maker’s "Optimize for" setting as the default "Minimum size" rather than "Standard" when it makes the PDF. This causes any images (such as a basic logo) in the PDF to be lossy and look like a dogs breakfast.

As Adobe used the old and much loved corporate chestnut "when threatened - sue them" after Microsoft introduced the ability to PDF stuff directly from Office apps it's unlikely the MS PDF add-in for 2007 will ever be upgraded. And sadly, it appears that when MS introduced the sendObject cmd they neglected to include the acExportQualityPrint variable (as is available with the outputTo cmd).

So, my question is... in a virtual world where there is no such thing as "saving to a hard drive" (ahh...the old days!), is there any VBA code that can replicate the sendObject cmd WITH something like the acExportQualityPrint variable? Thus enabling report images to render without compression loss in the PDF.

I've spent days googling to find the answer but to no avail.

Challenging huh! Are there any gurus out there?

Kingdoz - I feel your pain.
 

kingdoz

Registered User.
Local time
Today, 10:23
Joined
Dec 2, 2008
Messages
29
This may be your lucky day JIK... I have found they answer for myself and it works without any hard coding... Let me know if it helps you as my hours of trial and error seemed to finally help me from tearing all my hair out :) If you save your background image or your logo as an EMF (vector version) then it does work. Seems to be the only format that does not compress graphics using SendObject. Let me know if it helps in your instance as only tested it with my own graphics. Thanks. Kingdoz.
 

JIK

New member
Local time
Today, 02:23
Joined
Jan 26, 2013
Messages
3
Thanks for your reply kingdoz! It sounded good but my db crashed after inserting the emf. Not sure why :banghead:

Eventually I gave up and instead created a procedure that outputs the file to a PDF, and then attaches the PDF to an email. It was annoying that I had to create a directory location to do it and then a ton of code to locate the directory etc. What a pain! All because of 1 tiny missed parameter in the source code!!

Thanks anyway for your help, cheers!
 

Users who are viewing this thread

Top Bottom