
View Message Thread (9 replies)
| Acc2007: code to print to pdf |
 |
From: Arno R Date Posted: 6/29/2010 6:42:00 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

| Re: Acc2007: code to print to pdf |
|
From: Jörn Bosse Date Posted: 6/29/2010 8:31:00 AM
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

| Re: Acc2007: code to print to pdf |
|
From: Jon Lewis Date Posted: 6/29/2010 8:38:00 AM
Try this:
DoCmd.RunCommand acCmdPublishFixedFormat
Jon
"Arno R" < arracomn_o_s_p_a_m@planet.nl> wrote in message
news:4c29e9ad$0$14124$703f8584@textnews.kpn.nl...
> 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
>

| Re: Acc2007: code to print to pdf |
|
From: Arno R Date Posted: 6/29/2010 11:08:00 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@cutthespambtinternet.com> schreef in bericht news:bumdnXyT4ZDbmLfRnZ2dnUVZ8u2dnZ2d@bt.com...
> Try this:
>
> DoCmd.RunCommand acCmdPublishFixedFormat
>
> Jon
>
> "Arno R" < arracomn_o_s_p_a_m@planet.nl> wrote in message news:4c29e9ad$0$14124$703f8584@textnews.kpn.nl...
>> 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
>>
>
>

| Re: Acc2007: code to print to pdf |
|
From: Arno R Date Posted: 6/29/2010 11:08:00 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@gmx.de> schreef in bericht news:88uec2FqlsU1@mid.uni-berlin.de...
> 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

| Re: Acc2007: code to print to pdf |
|
From: Albert D. Kallal Date Posted: 6/29/2010 5:16:00 PM
"Arno R" < arracomn_o_s_p_a_m@planet.nl> wrote in message
news:4c29e9ad$0$14124$703f8584@textnews.kpn.nl...
> 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@msn.com

| Re: Acc2007: code to print to pdf |
|
From: Albert D. Kallal Date Posted: 6/29/2010 5:17:00 PM

| Re: Acc2007: code to print to pdf |
|
From: Arno R Date Posted: 6/30/2010 11:08:00 AM

| Re: Acc2007: code to print to pdf |
|
From: Albert D. Kallal Date Posted: 7/1/2010 1:23:00 AM
"Arno R" < arracomn_o_s_p_a_m@planet.nl> wrote in message
news:4c2b79df$0$14122$703f8584@textnews.kpn.nl...
> 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@msn.com

| Re: Acc2007: code to print to pdf |
|
From: Arno R Date Posted: 7/1/2010 2:40:00 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@msn.com> schreef in bericht news:5nXWn.4147$oN4.2379@newsfe04.iad...
> "Arno R" < arracomn_o_s_p_a_m@planet.nl> wrote in message news:4c2b79df$0$14122$703f8584@textnews.kpn.nl...
>> 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@msn.com
>
>
>

Would you like to track this thread?
By adding this News Thread to your Favorites Area you can refer to it later with just a click of the mouse.
Also you can optionally be notified instantly whenever there are any replies
posted to this Thread. To add this Thread to your Favorites Area just click on the red arrow next to the subject of the thread above
.
|