Access-Error printing Word Document from Access 
Author Message
 Access-Error printing Word Document from Access

I have written code (below) to print a document in Word by pulling the
file name from an Access table.  My problem is these documents are
updated daily from an outside source.  On my printer I get an out of
margin error on a number of these documents. Because they are replaced
regularly it is not realistic to go in a reset the margins.  The source
I receive the documents from does not get an error.  I have tried
different printer drivers, but that was no help. What I would like to
do is over ride the error message or reset the margins within the code
below.  Can anyone help me.

Set CurrentForm = Screen.ActiveForm
    If CurrentForm![SPI 1] <> "" Then
        DocName = "SPI" & CurrentForm![SPI 1].Value & ".DOC"
    With oApp
        .Documents.Add ("D:\access\cmis\" & DocName)
        .ActiveDocument.PrintOut
        .ActiveDocument.Close
    End With
    End If

Thanks,
Pinkiee

Sent via Deja.com http://www.*-*-*.com/
Before you buy.



Thu, 02 Jan 2003 03:00:00 GMT  
 Access-Error printing Word Document from Access
The page margins are forced by your printer.  Different drivers for the same
printer won't change anything if the printers capabilities don't change.
To manage the margins you'd need to use code something like:

.ActiveDocument.PageSetUp.RightMargin = XXX points.

You have to convert inches or cms to points to use this function.  Note that
since you are doing this via automation, Word's built in conversion
functions (e.g. inches to points) aren't readily available so do your own
simple conversions.   One inch = 72 points, 1 cm = 28.35 points.

--
Steve Arbaugh
ATTAC Consulting Group
http://ourworld.compuserve.com/homepages/attac-cg/acgsoft.htm

Quote:

> I have written code (below) to print a document in Word by pulling the
> file name from an Access table.  My problem is these documents are
> updated daily from an outside source.  On my printer I get an out of
> margin error on a number of these documents. Because they are replaced
> regularly it is not realistic to go in a reset the margins.  The source
> I receive the documents from does not get an error.  I have tried
> different printer drivers, but that was no help. What I would like to
> do is over ride the error message or reset the margins within the code
> below.  Can anyone help me.

> Set CurrentForm = Screen.ActiveForm
>     If CurrentForm![SPI 1] <> "" Then
>         DocName = "SPI" & CurrentForm![SPI 1].Value & ".DOC"
>     With oApp
>         .Documents.Add ("D:\access\cmis\" & DocName)
>         .ActiveDocument.PrintOut
>         .ActiveDocument.Close
>     End With
>     End If

> Thanks,
> Pinkiee

> Sent via Deja.com http://www.deja.com/
> Before you buy.



Thu, 02 Jan 2003 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Printing Word Document From Access VBA

2. Printing Word Documents From Access

3. What is the syntax for printing out Mail Merge document in Word from Access Form

4. Using Find in a Word document from Access freezes Access

5. Error in accessing a word document

6. Accessing XML document from a Word document

7. Generating word document files from embedded documents in Access or SQL Server DB.

8. accessing word document through vb.net using word com object

9. Print formatting problems -- Using VBA in Access 2000 to print a doc in Word

10. move between Access and Word, back to Access, Close word

11. Print a word document built from multiple sub documents using the RD tag

12. Help. Reading/displaying/printing Word Documents/RTF documents

 

 
Powered by phpBB® Forum Software