Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Design Help with Printing Many Files

Status
Not open for further replies.

DaveMac

Technical User
Apr 9, 2000
161
0
0
US
I need a little design help on the follow problem, thanks in advance.

Current state: We have 121 rtf documents that users open in word to prepare for a survey.
Use factors: Users select between 5 and 25 documents to print and take with them. The selection is up to the user and cannot be static.
User Desire: A Form that has the 121 document names and a check box next to them. I check the ones I want and they all print.

I have tried to move the rtf to a report however due to some of the formatting and etc these may have to stay as word docs or rtf files.
1) Is there a way to store a file or path in a table and call it for print?
2) If I go that route would users have to open word and print 25 times etc?
a. Can I code the open, print close via VBA? I can code some VB
3) Best case would maybe be an object on a report or form that is a bound word doc
Thanks!
 
Where are those files located? Are they in one place (on the server somewhere?) or are they scatter all over? If so, can you place them in one location so you can use Dir to populate the list box with the names of the files.

I did something like that a few years ago, in VB6.
User pointed to the location with the file he wanted to print, I gave him a list of files in the listbox from the chosen location. He could choose one, several, or with one click he could choose them all (*.doc files). Then he just clicked ‘Print’ command button and went away to get some coffee. Program (MSWord) started in the memory, opened every file, send it to the printer, closeed the file, opened another one, etc. A few minutes later he had all of the files printed on the (default) printer. He was happy, and got his morning coffee in the process.


Have fun.

---- Andy
 
Andy, That sounds like what I need. Do you have any samples of that code? I hate to ask but I am not a programmer so I always take forever to connect the dots.

Thanks!
 
I don't have a problem providing you with the code (if I can find it), but:
1. Do you have access to VB 6.0 ? It is NOT VBA nor VB.NET, you know...
2. Where are those files located? Are they in one place (on the server somewhere?) or are they scatter all over?

Have fun.

---- Andy
 
They can be moved anywhere so the directory should be fine. As for the scripting I did plan on using Access 2010 VBA. If you find samples that owuld be great however I think I have the chain understood given your description.

Thanks for your help!
 
I would do it in Access only if I would have a table of needed files to be printed by the user. This table could be set up the way so if a user needs to print Word files for case A, pre-selected files would be printed. If that would be a case B, other files would be printed.

But if my user would select set of different files every time from the list of all Word files, I would do it in MSWord. No need to call the Word object, you are already in there :)

A simple GUI: one UserForm in Word, a listbox, a couple of buttons and a simple macro record to print a file:

Code:
    Documents.Open FileName:="SomeDocFile.docx", ConfirmConversions:=False, _
        ReadOnly:=True, AddToRecentFiles:=False
    Application.PrintOut FileName:="", Range:=wdPrintAllDocument, Item:= _
        wdPrintDocumentWithMarkup, Copies:=1, Pages:="", PageType:= _
        wdPrintAllPages, Collate:=True, Background:=True, PrintToFile:=False, _
        PrintZoomColumn:=0, PrintZoomRow:=0, PrintZoomPaperWidth:=0, _
        PrintZoomPaperHeight:=0
    ActiveDocument.Close

you can loop thru selected Word files and print them out with the code above (from Word's macro). I am sure you can even trim this code down.

If you need more helop with Word VBA you can go to "VBA Visual Basic for Applications (Microsoft)" forum.


Have fun.

---- Andy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top