[AccessD] Printing a word document from Access

Hale, Jim Jim.Hale at FleetPride.com
Wed Jun 28 10:23:23 CDT 2006


How about making a temp copy of the file, open and print and then delete.
Not elegant but should do the trick. HTH
Jim Hale

-----Original Message-----
From: rusty.hammond at cpiqpc.com [mailto:rusty.hammond at cpiqpc.com]
Sent: Wednesday, June 28, 2006 9:54 AM
To: accessd at databaseadvisors.com
Subject: Re: [AccessD] Printing a word document from Access


Thanks Marty but I still get the prompt if the file is already opened
elsewhere.  Any other ideas?


-----Original Message-----
From: MartyConnelly [mailto:martyconnelly at shaw.ca]
Sent: Tuesday, June 27, 2006 6:08 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Printing a word document from Access


You don't need the newDoc  object try something like

 Set AppObject = CreateObject("Word.Application")
    AppObject.DisplayAlerts = False
    '**** In the following line, if the file is already open we get an 
error ****
    AppObject.Documents.Open MyFilePath, False, True
   AppObject.Visible = False
'lots of options available here
   AppObject.PrintOut _
        Background:=False, _
        Append:=False

rusty.hammond at cpiqpc.com wrote:

>Using Access 97 and Word 2000, I simply want to open a word or rich text
>format (.rtf) file and print it.  If someone already has the file open,
Word
>pops up a dialog saying the file is locked for editing and I have to choose
>to open it Read-Only, Notify me when it is closed or Cancel the request.
If
>I click on the Read Only button the file is opened and printed and I'm on
my
>merry way, BUT I need the printing to be automated.  Is there a way to
>suppress this prompt?  I'm already telling word to open the document read
>only but it doesn't help - any ideas?
>
>Sample code follows:
>
>Function PrintWordDoc()
>
>    Dim AppObject As Object
>    Dim NewDoc As Object
>    
>    Set AppObject = CreateObject("Word.Application")
>    AppObject.DisplayAlerts = False
>    '**** In the following line, if the file is already open we get an
error
>****
>    Set NewDoc = AppObject.Documents.Open("c:\logs\rptNewCash.rtf", False,
>True)
>    NewDoc.PrintOut False
>    NewDoc.Close
>    AppObject.Quit
>    Set AppObject = Nothing
>
>End Function
>
>
>Rusty Hammond
>IT Dept. - B-20
>CPI Qualified Plan Consultants, Inc.
>(620) 793-8473 ext. 416
>rusty.hammond at cpiqpc.com
>
>
>**********************************************************************
>WARNING: All e-mail sent to and from this address will be received,
>scanned or otherwise recorded by the CPI Qualified Plan Consultants, Inc.
>corporate e-mail system and is subject to archival, monitoring or review 
>by, and/or disclosure to, someone other than the recipient.
>**********************************************************************
>  
>

-- 
Marty Connelly
Victoria, B.C.
Canada

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

**********************************************************************
WARNING: All e-mail sent to and from this address will be received,
scanned or otherwise recorded by the CPI Qualified Plan Consultants, Inc.
corporate e-mail system and is subject to archival, monitoring or review 
by, and/or disclosure to, someone other than the recipient.
**********************************************************************
-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

***********************************************************************
The information transmitted is intended solely for the individual or
entity to which it is addressed and may contain confidential and/or
privileged material. Any review, retransmission, dissemination or
other use of or taking action in reliance upon this information by
persons or entities other than the intended recipient is prohibited.
If you have received this email in error please contact the sender and
delete the material from any computer. As a recipient of this email,
you are responsible for screening its contents and the contents of any
attachments for the presence of viruses. No liability is accepted for
any damages caused by any virus transmitted by this email.


More information about the AccessD mailing list