Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

bypass save as using cutepdf

1,580 views
Skip to first unread message

fs

unread,
Feb 1, 2013, 8:57:39 AM2/1/13
to
Hi,
Using Office 2003 and XP.
We want to email pdf's of merged Word docs (again 2003). I can open the word document and change the active printer to CutePdf Writer.
I want to bypass the save as dialog box and pass the same string each time as the file location/name for the pdf. I will attach it to an outlook email and then delete it from the disk. Essentiall, automate creating the pdf and attaching it to an email so that the user doesn't have to leave the Access App.
I've been trawling the net for hours and have ended up going round in circles. Can anyone help?
Thanks,
Franc.

Douglas J Steele

unread,
Feb 1, 2013, 5:51:24 PM2/1/13
to
I don't think it's possible with CutePDF. I think you'll need to get another
product in order to get that capability.

"fs" wrote in message
news:cd8f828a-2eb3-44ef...@googlegroups.com...

David Hare-Scott

unread,
Feb 1, 2013, 6:20:53 PM2/1/13
to
I don't have office 2003 but I am assuming Access 2003 can generate PDFs
from reports and Word 2003 can generate PDFs. If so you could cut Word out
of it altogether by generating your PDFs within Access and then emailing
them with SendObject or using automation from Outlook. Or if you must use
Word control the generation of the PDF from Access using automation and then
email it via Outlook also using automation. Automation is pretty easy if
you can code in VBA, you just have to climb through the object models of the
app you are controlling. There are plenty of examples of such code about.
If you have no VBA life is more difficult.

David




Albert D. Kallal

unread,
Feb 2, 2013, 1:50:11 AM2/2/13
to
"David Hare-Scott" wrote in message news:kehil4$f4m$1...@news.albasani.net...


>I don't have office 2003 but I am assuming Access 2003 can generate PDFs
>from reports and Word 2003 can generate PDFs.

Unfotantly, office 2003 does not (did not) have PDF ability.

However, the free PDF add-in from Stephan here works well with Access 2003.

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

So while word cannot generate pdf's, with Stephan's add-in, Access 2003 does
a great job and allows one to specify the pdf output name without dialogs.

> If so you could cut Word out of it altogether by generating your PDFs
> within Access and then emailing them with SendObject or using automation
> from Outlook.

Great advice! - I 100% agree. Even with Access 2003, you don't need to mess
with cute pdf.

>Or if you must use Word control the generation of the PDF from Access using
>automation and then email it via Outlook also using automation. Automation
>is pretty easy if you can code in VBA

100% agree - the big problem is word 2003 does not have PDF ability - this
is likely why the poster is using cutePDF. Not sure, but it sounds like they
need word here - but if they can cut out need of word, then an all Access
solution as suggested here is my bet and suggestion also.

cutePDF is GREAT, but does not support automation.

To the poster:

if you need program control of PDF output, and need a free solution, then
this one can be used:

http://sourceforge.net/projects/pdfcreator/

The above allows VBA from Access (or word) to create PDF's under program
control without user dialogs.

--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
PleaseNoS...@msn.com

fs

unread,
Feb 4, 2013, 9:03:37 AM2/4/13
to
On 2 Feb, 06:50, "Albert D. Kallal" <PleaseNOSpamkal...@msn.com>
wrote:
> "David Hare-Scott"  wrote in messagenews:kehil4$f4m$1...@news.albasani.net...
> PleaseNoSpam_kal...@msn.com

Hi all,
Thanks for your responses.
Yes, unfortunately my client is wedded to being able to edit their
documents from within Word, so I can't use Stephen Lebans excellent
pdf add-in for this.
I have downloaded PDFCreator from SourceForge, do you have any example
code of how to use it from Access?
Thanks again,
Franc.

Phil

unread,
Feb 4, 2013, 11:07:13 AM2/4/13
to
On 01/02/2013 13:57:38, fs wrote:
> Hi,
> Using Office 2003 and XP.
> We want to email pdf's of merged Word docs (again 2003). I can open the wo
> rd document and change the active printer to CutePdf Writer. I want to
> bypass the save as dialog box and pass the same string each time as the
> file location/name for the pdf. I will attach it to an outlook emai l and
> then delete it from the disk. Essentiall, automate creating the pdf and
> attaching it to an email so that the user doesn't have to leave the Acc
> ess App. I've been trawling the net for hours and have ended up going
> round in circl es. Can anyone help?
> Thanks,
> Franc.
>

Don't know it it's of any help, but the PDF995 printer has command line
switches. Whether that will be of any use, I don't know. I used it for
something, and I can't remember what. Senile old fart - that's me'

Phil

fs

unread,
Feb 4, 2013, 12:15:48 PM2/4/13
to
The PDFCreator on SourceForge that Albert linked has done the job
perfectly. (I tried PDF995 but it has a pop up after each use which I
think would get a bit annoying after a while.) From within the
Options I could set whether to bypass the 'Save As' dialog or whether
to give the pdf file a std name or a sequential type name. It also
gives the option of whether to view the pdf straight away or attach to
an email. I've pasted my function at the bottom of this post in case
in case it helps.

I can now create pdf's of Word documents which have been merged with
data from the Access database. I have one last problem though, how to
apply a Word template to a Word document which is already open? The
original Word documents are printed on headed paper. When creating
the pdf, I need to recreate the headed paper layout with a header and
footer graphic. We could have two separate Word documents, one for
printing and one for pdf, but that would mean twice as much upkeep and
editing, then version issues and so on. It would be a lot cleaner to
just have one Word document to maintain. Is there a way to apply the
'pdf' template to the existing Word document and then I can send it to
the PDF printer?

Thanks again!


************************************************************************************************************************************
************************************************************************************************************************************

Public Function make_pdf()
' this function will take the word doc, merge it with merge.txt and
create a pdf called C:\letter-to-send.pdf

' check if C:\letter-to-send.pdf already exists, if so, delete it.
If Dir("C:\letter-to-send.pdf") <> "" Then
Kill "C:\letter-to-send.pdf"
End If

' open document in Word, merge data and send to pdf printer, then
reset the printer back to previous printer.
Dim ow As Word.Application
Dim x_doc As Word.Document
Dim x_current_printer As String
Set ow = CreateObject("Word.Application")
x_current_printer = ow.ActivePrinter
ow.ActivePrinter = "PDFCreator" ' PDFCreator printer is set up to save
to C:\letter-to-send.pdf
ow.Visible = False
Set x_doc = ow.Documents.Open("C:\letter.doc")

With x_doc.MailMerge
.OpenDataSource ("C:\merge.txt")
End With
With x_doc
.MailMerge.Destination = wdSendToPrinter
.MailMerge.Execute
End With
ow.ActivePrinter = x_current_printer ' resets the printer back to
previous printer.
ow.Documents.Close False
ow.Quit
End Function

fs

unread,
Feb 4, 2013, 12:39:20 PM2/4/13
to
I have tried using

ow.ActiveDocument.AttachedTemplate = "C:\letterhead.dot"

but it is not affecting the open document.

Any ideas?

Aikistan

unread,
Feb 4, 2013, 5:11:35 PM2/4/13
to
As far as I know, applying Word template doesn't affect an open document's formatting. I don't have any experience manipulating Word documents from Access but, in Word, either the document has to be created with the template you want or you can copy the text from the open document into a new document created with the template (paste text only).

Maybe this will generate a useful direction...

Albert D. Kallal

unread,
Feb 5, 2013, 7:12:00 PM2/5/13
to
I don't have Access code, but I do have some VBScripts hanging around some
place.

However, keep in mind that GREAT number of VBscript (which reads like VBA)
is included with the download.

I believe the sample scripts are installed in the program dir (which on a
x64 box would thus be under:

C:\Program Files (x86)\ ????

I don't have the source forge system installed on this current computer, but
it does have some sample word automation code written in VBscript that
would/should work great with Access


--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
PleaseNoS...@msn.com

fs

unread,
Feb 6, 2013, 10:06:52 AM2/6/13
to
On 6 Feb, 00:12, "Albert D. Kallal" <PleaseNOSpamkal...@msn.com>
wrote:
> PleaseNoSpam_kal...@msn.com

Hi Albert,
Yes there is a folder called Scripts with a script called
AddWatermarkToPDF.vbs which looks promising.
I'll check it out.
Thanks again,
Franc.

Access Developer

unread,
Feb 16, 2013, 4:30:30 PM2/16/13
to
"Albert D. Kallal" <PleaseNOS...@msn.com> wrote

> However, the free PDF add-in from Stephan here works
> well with Access 2003.
>
> http://www.lebans.com/ReportUtilities.htm

Oh, my, I miss having Stephen taking on the personal challenge of filling in
gaps in Access; I'm so sad he chose to retire from "all things Access",
though I wish him well in his new avocation(s).

Larry Linson


0 new messages