dbTalk Databases Forums  

Acc2007: code to print to pdf

comp.databases.ms-access comp.databases.ms-access


Discuss Acc2007: code to print to pdf in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Arno R
 
Posts: n/a

Default Acc2007: code to print to pdf - 06-29-2010 , 07:40 AM






Hi all,

I need to print to (or publish) an Access report to pdf with code.
This is a standard option with Access 2007 (SP2)

BUT....I don't want to use the option on the ribbon for this.
I need/want to code this.

Any ideas?
Thanks, Arno R

Reply With Quote
  #2  
Old   
Jörn Bosse
 
Posts: n/a

Default Re: Acc2007: code to print to pdf - 06-29-2010 , 09:30 AM






Am 29.06.2010 14:40, schrieb Arno R:
Quote:
Hi all,

I need to print to (or publish) an Access report to pdf with code.
This is a standard option with Access 2007 (SP2)

BUT....I don't want to use the option on the ribbon for this.
I need/want to code this.

Any ideas?
Thanks, Arno R


Hi,

you could use:
DoCmd.OutputTo acOutputReport, "repName", acFormatPDF

if you have installed the "save as pdf and xps" addin for Office 2007
and you need a pdf creator.

This function has some more arguments, to get more information, mark
OutputTo and press F1.

Regards
Jörn

Reply With Quote
  #3  
Old   
Jon Lewis
 
Posts: n/a

Default Re: Acc2007: code to print to pdf - 06-29-2010 , 09:37 AM



Try this:

DoCmd.RunCommand acCmdPublishFixedFormat

Jon

"Arno R" <arracomn_o_s_p_a_m (AT) planet (DOT) nl> wrote

Quote:
Hi all,

I need to print to (or publish) an Access report to pdf with code.
This is a standard option with Access 2007 (SP2)

BUT....I don't want to use the option on the ribbon for this.
I need/want to code this.

Any ideas?
Thanks, Arno R

Reply With Quote
  #4  
Old   
Arno R
 
Posts: n/a

Default Re: Acc2007: code to print to pdf - 06-29-2010 , 11:58 AM



Thanks,
I needed the standard functionality to 'print as PDF' on a custom toolbar.
This is meant for 2003 apps used by the Access2007 Runtime where I do NOT want to show the ribbon.

But this code option is very useful also.

Regards, Arno R


"Jörn Bosse" <joernbosse (AT) gmx (DOT) de> schreef in bericht news:88uec2FqlsU1 (AT) mid (DOT) uni-berlin.de...
Quote:
Am 29.06.2010 14:40, schrieb Arno R:
Hi all,

I need to print to (or publish) an Access report to pdf with code.
This is a standard option with Access 2007 (SP2)

BUT....I don't want to use the option on the ribbon for this.
I need/want to code this.

Any ideas?
Thanks, Arno R



Hi,

you could use:
DoCmd.OutputTo acOutputReport, "repName", acFormatPDF

if you have installed the "save as pdf and xps" addin for Office 2007 and you need a pdf creator.

This function has some more arguments, to get more information, mark OutputTo and press F1.

Regards
Jörn

Reply With Quote
  #5  
Old   
Arno R
 
Posts: n/a

Default Re: Acc2007: code to print to pdf - 06-29-2010 , 11:59 AM



Thanks,
Exactly what I needed...
I only needed to search for the value of the constant to avoid a compile error in Access2003

I needed the functionality on a custom toolbar.
Now I can code in Access2003 and distribute the app with the Access 2007 Runtime.

Regards, Arno R


"Jon Lewis" <jon.lewis (AT) cutthespambtinternet (DOT) com> schreef in bericht news:bumdnXyT4ZDbmLfRnZ2dnUVZ8u2dnZ2d (AT) bt (DOT) com...
Quote:
Try this:

DoCmd.RunCommand acCmdPublishFixedFormat

Jon

"Arno R" <arracomn_o_s_p_a_m (AT) planet (DOT) nl> wrote

Hi all,

I need to print to (or publish) an Access report to pdf with code.
This is a standard option with Access 2007 (SP2)

BUT....I don't want to use the option on the ribbon for this.
I need/want to code this.

Any ideas?
Thanks, Arno R



Reply With Quote
  #6  
Old   
Albert D. Kallal
 
Posts: n/a

Default Re: Acc2007: code to print to pdf - 06-29-2010 , 06:16 PM



"Arno R" <arracomn_o_s_p_a_m (AT) planet (DOT) nl> wrote

Quote:
Hi all,

I need to print to (or publish) an Access report to pdf with code.
This is a standard option with Access 2007 (SP2)

BUT....I don't want to use the option on the ribbon for this.
I need/want to code this.

Any ideas?
Thanks, Arno R

I have a download sample here:

In the above, I have a PDF button on the ribbon, and ALSO even a email as
PDF button on the ribbon.


Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
NoSpam_kallal (AT) msn (DOT) com

Reply With Quote
  #7  
Old   
Albert D. Kallal
 
Posts: n/a

Default Re: Acc2007: code to print to pdf - 06-29-2010 , 06:16 PM



sorry, link here:

http://www.members.shaw.ca/AlbertKal...s/DownLoad.htm

Reply With Quote
  #8  
Old   
Arno R
 
Posts: n/a

Default Re: Acc2007: code to print to pdf - 06-30-2010 , 12:07 PM



Hi Albert,

Thanks for the link, but I was NOT looking for an option on the ribbon...
I needed the standard functionality to 'print as PDF' on a custom toolbar.
This is meant for 2003 apps used by the Access2007 Runtime where I do NOT want to show the ribbon.

However the XML code maybe useful.

Regards, ArnoR



"Albert D. Kallal" <PleaseNOOOsPAMmkallal (AT) msn (DOT) com> schreef in bericht news:h9vWn.5780$3%3.3668 (AT) newsfe23 (DOT) iad...
Quote:
sorry, link here:

http://www.members.shaw.ca/AlbertKal...s/DownLoad.htm


Reply With Quote
  #9  
Old   
Albert D. Kallal
 
Posts: n/a

Default Re: Acc2007: code to print to pdf - 07-01-2010 , 02:23 AM



"Arno R" <arracomn_o_s_p_a_m (AT) planet (DOT) nl> wrote

Quote:
Hi Albert,

Thanks for the link, but I was NOT looking for an option on the ribbon...
I needed the standard functionality to 'print as PDF' on a custom toolbar.
This is meant for 2003 apps used by the Access2007 Runtime where I do NOT
want to show the ribbon.

Ok, first keep in mind that office 2007 and 2010 don't "print" as pdf. The
feature is native, and thus you save your document as a PDF. It only those
PDF printers you install that work that way, not applications that have pdf
support built in like office.

So, just have your menu bar button call some VBA code to save the report as
PDF.

So, in a standard code module, you can place:

Public Function SaveAsPDF()

DoCmd.OutputTo acOutputReport, Screen.ActiveReport.name, acFormatPDF


End Function

so, then on your menu bar button, just set the on action to the above

eg:

=SaveAsPdf()

So, it only one line of code in a module, and your menu bar button code can
then call the above VBA code as per above. If you not talking about a custom
menu bar button, then just call the code behind a button like:

SaveAsPDF



Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
kallal (AT) msn (DOT) com

Reply With Quote
  #10  
Old   
Arno R
 
Posts: n/a

Default Re: Acc2007: code to print to pdf - 07-01-2010 , 03:37 AM



Thanks again Albert,

I allready figured this out.
FYI: I also needed to change the (unknown to Access2003) constant acFormatPDF to "PDF Format (*.pdf)" since Access 2003 would not
compile anymore...

Arno R


"Albert D. Kallal" <PleaseNOOOsPAMmkallal (AT) msn (DOT) com> schreef in bericht news:5nXWn.4147$oN4.2379 (AT) newsfe04 (DOT) iad...
Quote:
"Arno R" <arracomn_o_s_p_a_m (AT) planet (DOT) nl> wrote

Hi Albert,

Thanks for the link, but I was NOT looking for an option on the ribbon...
I needed the standard functionality to 'print as PDF' on a custom toolbar.
This is meant for 2003 apps used by the Access2007 Runtime where I do NOT want to show the ribbon.


Ok, first keep in mind that office 2007 and 2010 don't "print" as pdf. The feature is native, and thus you save your document as a
PDF. It only those PDF printers you install that work that way, not applications that have pdf support built in like office.

So, just have your menu bar button call some VBA code to save the report as PDF.

So, in a standard code module, you can place:

Public Function SaveAsPDF()

DoCmd.OutputTo acOutputReport, Screen.ActiveReport.name, acFormatPDF


End Function

so, then on your menu bar button, just set the on action to the above

eg:

=SaveAsPdf()

So, it only one line of code in a module, and your menu bar button code can then call the above VBA code as per above. If you not
talking about a custom menu bar button, then just call the code behind a button like:

SaveAsPDF



Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
kallal (AT) msn (DOT) com



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.