Custom Toolbar Button for PDFs

J

JimP

I have a "Page Setup..." button on a custom toolbar that appears when a
report is displayed in preview mode. Selecting "Custom Printer" allows a
user to select an installed pdf viewer (e.g. Acrobat Reader) to print a
report to.

Is there a way to create a toolbar button, that will automatically send the
report to the pdf printer (viewer)?
 
A

Albert D. Kallal

I would actually recommend that you use Stephens free solution to create a
PDF, and that way your software will function on machines that don't
necessarily have a version of Adobe installed. (that and more importantly
who will not have to actually changed printers to accomplish the goal of
sending the report to a pdf). (I should probably know that the solutions
100% free also).

For all of my report's in ms-access applications I always build *one* custom
menu bar called reports and use that for every single report that I make.
This custom menu bar will have an option to print to the default printer, an
option to print a specific printer, and e-mail option that will launch the
person's e-mail client with the current report we are viewing being
converted to pdf *and* attached to the email cleint we just launched. and
one could also add an save as PDF option to the menu bar.

The above stuff is quite difficult to do for using the Adobe printer driver
stuff, Stephens example code makes this rather easy to do (the email part
for example).

However for your current situation I guess the code programming logic behind
the but for the report to make a PF would be as follows:

1) save the users current default printer settings that they have
2) switched the printer to the PDF printer driver.

3) execute a print command will will send the reprot we are viewing to the
pdf write
(I assume that the PDF driver will prompt the user for location to save the
pdf file name at this point).

3) after the printing has occurred you reset (return) the default printer
back to whatever it was.

So when you create a custom menu bar, I would suggest that you have the
following code for the button on the menu bar run :

So, to save/switch, you can use:

dim strDefaultPrinter as string

' get current default printer.
strDefaultPrinter = Application.Printer.DeviceName

' switch to printer of your choice:

Set Application.Printer = Application.Printers("Adobe printer name
whatever")

do whatever. (something like)

Dim strReportName as string

strREportName = Screen.ActiveReport.Name
DoCmd.SelectObject acReport, strReportName
DoCmd.PrintOut acPrintAll

Swtich back.

Set Application.Printer = Application.Printers(strDefaultPrinter)
 
J

JimP

How can I find "Stephens" free solution, or your solution? It's exactly wjat
I'm looking for.
 
J

JimP

Note to Albert D. Kallal or others reading this post. I have been using
Leban's dlls for creating pdfs, but I'm especially interested in the
following.

"and e-mail option that will launch the
person's e-mail client with the current report we are viewing being
converted to pdf *and* attached to the email cleint we just launched"

How to do this?
 
J

JimP

Note to Albert D. Kallal or others reading this post. I have been using
Leban's dlls for creating pdfs, but I'm especially interested in the
following.

"and e-mail option that will launch the
person's e-mail client with the current report we are viewing being
converted to pdf *and* attached to the email cleint we just launched"

How to do this?
 
S

Stephen Lebans

Use GoogleGRoups. Your issue has been posted many times over the last
several months. I think it might have been Albert that posted sample source
code to Automate Outlook.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
J

JimP

Thankyou for the response. I was able to locate a Microsoft article
(Q161088) that descibes "Using Automation to Send a Microsoft Outlook
Message" - turns out to be quite easy.

However, how do I capture/pass the pdf save file name from (Stephen Lebans
dlls dynapdf/StrStorage) to a subroutine ?
 
J

JimP

Please disregard prior post.


JimP said:
Thankyou for the response. I was able to locate a Microsoft article
(Q161088) that descibes "Using Automation to Send a Microsoft Outlook
Message" - turns out to be quite easy.

However, how do I capture/pass the pdf save file name from (Stephen Lebans
dlls dynapdf/StrStorage) to a subroutine ?
 

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