Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / February 2007

Tip: Looking for answers? Try searching our database.

Passing a file name to PDF Printer

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Stu - 19 Feb 2007 03:33 GMT
Hello

I'm trying to write a macro in Word 2003 that will print individual PDF
files for each record in a mail merge, with the file name being sourced from
a field in the data source.  I can capture the value OK (checked via a
temporary MsgBox) but I'm having no success in trying to pass that value to
the dialog box for the PDF printer (in the current case, Jaws PDF Creator).

The menu command installed by Jaws invokes a custom-installed macro as
   Application.Run MacroName:="JawsPdfCreator.CreatePDF.CreateJawsPdfFile"

That opens the dialog box with the filename of the active document
highlighted - what I want to do is replace the highlighted value with the
filename I create from the source data field.

SendKeys doesn't work (it regards the active document as the active object,
and types it in there), and I don't know enough about the Jaws DDE stuff to
use the DDE commands.

Any help or clues would be mightily appreciated

Stu
Doug Robbins - Word MVP - 19 Feb 2007 04:49 GMT
See the "Individual Merge Letters" item on fellow MVP Graham Mayor's website
at:

http://www.gmayor.com/individual_merge_letters.htm

If you are using Word XP or later, the work has all been done for you in the
"Add-in to Merge Letters to Separate Files" that I have written and that can
be downloaded from that site will allow you to create each letter as a
separate file with a filename taken from a field in the data source with a
minimum of fuss, plus create the output as .pdf files.

Signature

Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

> Hello
>
[quoted text clipped - 23 lines]
>
> Stu
Stu - 19 Feb 2007 05:19 GMT
Doug, it looks just the berries!

I'll run a couple of tests and post an outcome.

Thanks a million.

Stu

> See the "Individual Merge Letters" item on fellow MVP Graham Mayor's website
> at:
[quoted text clipped - 34 lines]
> >
> > Stu
Stu - 19 Feb 2007 07:02 GMT
Hello again Doug

Two problems:

1.  It doesn't work with Jaws PDF Creator, even if I replace "Adobe PDF"
with "Jaws PDF Creator" (which is the name Word seems to recognise when I
record a macro to change the printer to that) in the code under Private Sub
app_MailMergeAfterMerge.  Is there any way to allow it to work with Jaws, or
is it "Adobe-particular"?

2.  When I run it without selecting the Create PDFs option, it creates the
individual documents, but comes up with Run-time error '91' - Object variable
or With block variable not set.  Going to debug has it pointing at the one
line of code in Sub DeleteResultsDocument().  I'm left with an empty
"FormLetters" document on screen.

Stu

> See the "Individual Merge Letters" item on fellow MVP Graham Mayor's website
> at:
[quoted text clipped - 34 lines]
> >
> > Stu
Graham Mayor - 19 Feb 2007 07:32 GMT
The problem with clone PDF creators is attributable to the way that they
create PDF filenames. eg If you have Snagit 8 then its driver can create
PDFs, but it will not automatically name them from the source. In the case
of the SnagIt driver, if you substitute that for the Adobe PDF driver then
the chances are that it will create the same error message.

With SnagIt 8, you can set it to automatically name the PDF files. If you do
this the add-in will create named doc files in the target location and
automatically named PDF files which do not carry the same name sequence as
the merged documents. I suspect that Jaws PDF creator works in a similar
way. The Adobe driver is rather more configurable,.

Signature

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor -  Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

> Hello again Doug
>
[quoted text clipped - 63 lines]
>>>
>>> Stu
Graham Mayor - 19 Feb 2007 07:40 GMT
Forgot to mention that if the field you use to name the documents contains
illegal filename characters, you will also get an error.

Signature

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor -  Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

> The problem with clone PDF creators is attributable to the way that
> they create PDF filenames. eg If you have Snagit 8 then its driver
[quoted text clipped - 76 lines]
>>>>
>>>> Stu
Stu - 19 Feb 2007 08:37 GMT
Hello Graham

Mmm..  familiar with the issue - Jaws does give you configurable options -
"Always/Never request Destination" and to include a default folder.  That's
if "save to PDF" is selected - and it's always the filename of the current
document (if it already exists, it appends a serial number.)  If the Jaws PDF
Creator is selected as the printer, it always requests a file name in the
dialog box.

In this instance, the file name I want to/have to assign will always be a
customerID - always an integer number cast as a string - followed by a date
code, as 12345_20070219.  That code is created within our database and is a
field in the merge source document.

Will do some more playing - and maybe have to go and buy Adobe8!

Thanks

Stu

> Forgot to mention that if the field you use to name the documents contains
> illegal filename characters, you will also get an error.
[quoted text clipped - 79 lines]
> >>>>
> >>>> Stu
Graham Mayor - 19 Feb 2007 09:37 GMT
If you can 'print' to the Jaws driver, and you can setup the driver to
automatically assign the filename from the document then as the add-in saves
each document then 'prints' it to the PDF driver, you might be able to coax
it to work. The only non-Acrobat driver I have used it with has been SnagIt
which works with the provisos already made. Doug wrote the code (I only did
some testing and provide the web host for the file) so he may know of other
drivers that have been tested with it. I seem to recall that at least one
other clone has been used. I hear that the freebie PrimoPDF may not work
(though I am currently downloading it to test).

Signature

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor -  Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

> Hello Graham
>
[quoted text clipped - 108 lines]
>>>>>>
>>>>>> Stu
Graham Mayor - 19 Feb 2007 10:18 GMT
Actually PrimoPDF works fine with two provisos. You get a prompt for each
record. In answer to the first prompt you change the destination path (but
not the file name). Then OK each record thereafter. A pain if it's a big
data file :(

Signature

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor -  Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

> If you can 'print' to the Jaws driver, and you can setup the driver to
> automatically assign the filename from the document then as the
[quoted text clipped - 119 lines]
>>>>>>>
>>>>>>> Stu
Michael Bednarek - 19 Feb 2007 11:20 GMT
>I'm trying to write a macro in Word 2003 that will print individual PDF
>files for each record in a mail merge, with the file name being sourced from
[quoted text clipped - 12 lines]
>and types it in there), and I don't know enough about the Jaws DDE stuff to
>use the DDE commands.

PDFCreator comes with a COM interface, offering much the same
flexibility and programmability as Adobe Acrobat does - no dialogue
boxes and no SendKeys necessary.

Signature

Michael Bednarek   http://mbednarek.com/   "POST NO BILLS"

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.