DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Print all documents in current directory

  1. #1
    James Calautti Guest

    Print all documents in current directory


    I am using VBA in Word 97, Windows 95. I need a macro that will print all
    the documents in the current directory of the active document. I tried the
    following code but got an error message stating "sub or procedure not defined"
    (a message I get frequently when working with files) and files$ was highlighted.
    This has jammed me up on my project for 4 days now. Can you please help?
    ThankYou!

    Sub PrintFile()
    doc$ = Files$("*.doc")
    While doc$<>""
    FilePrint.FileName = doc$


  2. #2
    Paul Clement Guest

    Re: Print all documents in current directory

    On 15 May 2001 08:25:07 -0700, "James Calautti" <jjcalaut@panynj.gov> wrote:


    I am using VBA in Word 97, Windows 95. I need a macro that will print all
    the documents in the current directory of the active document. I tried the
    following code but got an error message stating "sub or procedure not defined"
    (a message I get frequently when working with files) and files$ was highlighted.
    This has jammed me up on my project for 4 days now. Can you please help?
    ThankYou!

    Sub PrintFile()
    doc$ = Files$("*.doc")
    While doc$<>""
    FilePrint.FileName = doc$

    You can use the ActiveDocument.Path method to retrieve the path of the active document.

    There is no Files$ function. You would need to use the Dir$ function to retrieve the files in the
    specified path.

    In addition, you would need to open each document in Word in order to print it out (PrintOut
    method).


    Paul ~~~ pclement@ameritech.net
    Microsoft MVP (Visual Basic)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center