Sending Access Data to Word, then Printing to PDF

Phantek

New Member
Joined
Apr 11, 2011
Messages
10
Okay, I have a macro that is doing a decent job of taking an Access record, opening up Word, copying the record into the Word form, and then printing it.

Everything falls apart when I try to get it to print to a PDF. In Word, I recorded a simple Macro to see how it did that and tried to adjust it to fit the coding in the Access Macro. This is what I am getting:

Code:
objWord.ActivePrinter = "Adobe PDF"
    objWord.Application.PrintOut Filename:="C:\Documents and Settings\me\My Documents\output.pdf", Range:=wdPrintAllDocument, Item:= _
        wdPrintDocumentContent, Copies:=1, Pages:="", PageType:=wdPrintAllPages, _
        ManualDuplexPrint:=False, Collate:=True, Background:=True, PrintToFile:= _
        False, PrintZoomColumn:=0, PrintZoomRow:=0, PrintZoomPaperWidth:=0, _
        PrintZoomPaperHeight:=0

Unfortunately, it is giving me the error:
Microsoft Office Access
5121
Word experienced an error trying to open the file.
Try these suggestions:
* Check the file permissions for the document or drive.
* Make sure there is sufficient free memory and disk space.
* Open the file with the Text Recovery converter.

Any ideas?
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Not sure what version of access you're using--I use 2003 and it doesn't do direct to pdf. My work-around has been to save the data in Word then open it in Word and manually save to pdf.

hth,

Rich
 
Upvote 0
I am using Office 2003. Is there not a way to be sending the Print to PDF command to Word, though? Yes the macro is in Access, but it is asking Word to print.
 
Upvote 0
I figured it out. In case someone else is hunting for the same thing, the problem is the way that pdf files are created. Rather than a pdf file being created directly, it is necessary to first create a .prn or .ps file (I went with .prn) and then use the Adobe Distiller to convert from .prn to a new .pdf file.
 
Upvote 0
Hi,
I need to do similar thing in Access 2003, can you email me
the complete final code you have for this?

I was also wondering if anyone has uploaded the content of a word
document and upload the content into a SQL Server table.

Thanks
 
Upvote 0

Forum statistics

Threads
1,224,537
Messages
6,179,405
Members
452,911
Latest member
a_barila

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top