Advertisement

There's no such thing as a stupid question, but they're the easiest to answer.
Login
Search

Advertisement

Business Applications Business Applications
Search Search
Search for:
Tech Support Guy > > >

Printing Multiple files from a folder


(!)

eathen's Avatar
eathen eathen is offline
Junior Member with 16 posts.
THREAD STARTER
 
Join Date: Jul 2006
Experience: Einstein
24-Jul-2006, 01:11 PM #1
Printing Multiple files from a folder
I would like to know how to print multiple files in a folder. For example, a folder contains 50 Ms Word documents that needs to be printed. I do not want to open each document to print. The driver I have for HP laserjet 4300tn is updated. Is there a batch file that needs to be created? Is there a solution to this issue? Or is there a workaround?

Tested the following attempts, nothing gets printed
I tried selecting all the document, right click>print.
Selected all the document, then dragged them onto the printer icon.
Copied the printer icon into the "send to" option, then selected all the document and selected send to> printer_name.
StumpedTechy's Avatar
Computer Specs
Member with 7,213 posts.
 
Join Date: Jul 2004
Location: Central Florida
Experience: Advanced
24-Jul-2006, 02:04 PM #2
I am thinking something is wrong.. you should be able to print doing it the ways you did -

http://www.samspublishing.com/articl...&seqNum=3&rl=1

Have you tried totally uninstalling, shutting down, reinstalling the print driver?
eathen's Avatar
eathen eathen is offline
Junior Member with 16 posts.
THREAD STARTER
 
Join Date: Jul 2006
Experience: Einstein
24-Jul-2006, 03:18 PM #3
Even after deleting the printer and reinstalling it from scrath does not help. The printer is networked in our office, does this have an effect?
kenneth2k1's Avatar
kenneth2k1 kenneth2k1 is offline
Member with 252 posts.
 
Join Date: Oct 2003
Location: San Diego
24-Jul-2006, 06:52 PM #4
One guess I have is to check the amount of installed RAM. If the size of the print job exceeds the amount of RAM the printer has, it may drop the jobs all together. Also, try only selecting 5 or so files to print and see if they go through.
Squashman's Avatar
Trusted Advisor with 19,645 posts.
 
Join Date: Apr 2003
Location: 1265 Lombardi Ave
24-Jul-2006, 07:09 PM #5
Funny you should mention this, we are experiencing the same problem on one of the PC's here at work. The user is trying to print about 40 single page text files and it will only print about three of them everytime we try selecting them all and right clicking to print. I have always done that method in the past but it doesn't seem to be working on her pc which is Windows 2000 SP4
__________________
.
kenneth2k1's Avatar
kenneth2k1 kenneth2k1 is offline
Member with 252 posts.
 
Join Date: Oct 2003
Location: San Diego
24-Jul-2006, 07:13 PM #6
I had a similar problem once, and the job wasn't spooling properly. It would get to a certain size and stop building the print job. Then the job never went through. What solved it was installing a network print monitor (it came with the printer's software) and that made the jobs go through for some reason. That was on 2k SP4 printing to a Canon imageclass.
eathen's Avatar
eathen eathen is offline
Junior Member with 16 posts.
THREAD STARTER
 
Join Date: Jul 2006
Experience: Einstein
25-Jul-2006, 07:31 PM #7
I am pretty sure the printer has enough ram to carry out the request. I believe the printer has 256 MB ram.
I have tried printing 15, 10, 5, 2 files at a time, I don’t even see the printer icon that come up in the system tray and the printer status is Ready.
It only prints single pages at a time.
Do guys think there is free third party software that will perform this function?
At our office we are running winxp pro sp2
Rollin_Again's Avatar
Member with 4,694 posts.
 
Join Date: Sep 2003
Location: Atlanta, GA - Planet Earth
Experience: Advanced
26-Jul-2006, 12:17 PM #8
You can use a VBA script or macro to do this. Does the directory containing the word files contain any other file types?

Put the following code into a notepad file and rename the file extension to .VBS
Make sure to change the file path to the path of your actual directory. Then save the VBS file and double click to execute.

Code:
set shApp = createobject("shell.application") 
set shFolder = shApp.namespace("C:\TEST") 
set shItems = shFolder.Items() 
for each shItem in shItems 
  shItem.invokeverb "&Print" 
next
Rollin

Last edited by Rollin_Again; 26-Jul-2006 at 01:03 PM..
eathen's Avatar
eathen eathen is offline
Junior Member with 16 posts.
THREAD STARTER
 
Join Date: Jul 2006
Experience: Einstein
27-Jul-2006, 03:54 PM #9
Thank you all for your help.
Rollin_Again nailed my question. Thanks a lot.
The folder only contained Ms Word documents. I have not tested with other file formats. How would you create a Macro for this issue?
Thank you once again.
Rollin_Again's Avatar
Member with 4,694 posts.
 
Join Date: Sep 2003
Location: Atlanta, GA - Planet Earth
Experience: Advanced
27-Jul-2006, 09:49 PM #10
The instructions for creating the stand-alone VB Script are in my post above. If you would rather have the code executed directly out of word let me know and I'll write the code for you.

Rollin
eathen's Avatar
eathen eathen is offline
Junior Member with 16 posts.
THREAD STARTER
 
Join Date: Jul 2006
Experience: Einstein
28-Jul-2006, 12:14 AM #11
You have resolved my issue.
But for reference in the future, I would not mind having the code execute directly out of Word.
Rollin_Again's Avatar
Member with 4,694 posts.
 
Join Date: Sep 2003
Location: Atlanta, GA - Planet Earth
Experience: Advanced
31-Jul-2006, 04:32 PM #12
Sorry it took so long to get back. I've attached a word document with the macro already attached. Just open the word document and run the macro called "PrintAll" This will pop up an explorer style window that will allow you to click the directory that want to print the contents of. The code currently assumes that the directory only contains word documents. It can be easily modified to include logic to ignore any files that are not word documents.

Copy and paste the following code into a blank module in Word and then run the macro called "PrintAll"

Code:
'API Declares
Private Declare Function SendMessage Lib "USER32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function SHBrowseForFolder Lib "shell32.dll" Alias "SHBrowseForFolderA" (lpbi As BrowseInfo) As Long
Private Declare Function SHGetPathFromIDList Lib "shell32.dll" Alias "SHGetPathFromIDListA" (ByVal pidl As Long, ByVal pszPath As String) As Long
Private Declare Sub CoTaskMemFree Lib "ole32.dll" (ByVal hMem As Long)

'API Constants
Private Const MAX_PATH = 260
Private Const BIF_RETURNONLYFSDIRS = 1
Private Const BIF_STATUSTEXT = 4

Private Const WM_USER = &H400
Private Const BFFM_INITIALIZED = 1
Private Const BFFM_SELCHANGED = 2
Private Const BFFM_SETSTATUSTEXTA = (WM_USER + 100)

Private Const BFFM_SETSELECTIONA = (WM_USER + 102)


'BrowseInfo Type
Private Type BrowseInfo
    hwndOwner As Long
    pIDLRoot As Long
    pszDisplayName As String
    lpszTitle As String
    ulFlags As Long
    lpfn As Long
    lParam As Long
    iImage As Long
End Type

'Private Variables
Private m_sDefaultFolder As String
Public Sub BrowseFolder()

frmBrowse.Show
frmBrowse.txtDirectory.Text = ""


End Sub

Public Function BrowseForFolder(DefaultFolder As String, Optional Parent As Long = 0, Optional Caption As String = "") As String
    Dim bi As BrowseInfo
    Dim sResult As String, nResult As Long

    bi.hwndOwner = Parent
    bi.pIDLRoot = 0
    bi.pszDisplayName = String$(MAX_PATH, Chr$(0))
    If Len(Caption) > 0 Then
        bi.lpszTitle = Caption
    End If
    bi.ulFlags = BIF_RETURNONLYFSDIRS
    bi.lpfn = GetAddress(AddressOf BrowseCallbackProc)
    bi.lParam = 0
    bi.iImage = 0

    m_sDefaultFolder = DefaultFolder

    nResult = SHBrowseForFolder(bi)

    If nResult <> 0 Then
        sResult = String(MAX_PATH, 0)
        If SHGetPathFromIDList(nResult, sResult) Then
            BrowseForFolder = Left$(sResult, InStr(sResult, Chr$(0)) - 1)
        End If

        CoTaskMemFree nResult
    End If
End Function


Private Function BrowseCallbackProc(ByVal hwnd As Long, ByVal uMsg As Long, ByVal lParam As Long, ByVal lpData As Long) As Long
    Select Case uMsg
        Case BFFM_INITIALIZED

            If Len(m_sDefaultFolder) > 0 Then

                SendMessage hwnd, BFFM_SETSELECTIONA, True, ByVal m_sDefaultFolder
            End If
    End Select
End Function


Private Function GetAddress(nAddress As Long) As Long
    GetAddress = nAddress
End Function

Public Sub PrintAll()

Dim txtDirectory As String

txtDirectory = BrowseForFolder(txtDirectory, , "&Select a directory:")


With Application.FileSearch
.NewSearch
.LookIn = txtDirectory
.SearchSubFolders = False
.FileType = msoFileTypeWordDocuments
If .Execute() > 0 Then
For i = 1 To .FoundFiles.Count
Application.PrintOut , , , , , , , , , , , , CStr(.FoundFiles(i))
Next i
End If
End With

End Sub
Regards,
Rollin
Attached Files
File Type: zip PrintAll.zip (11.6 KB, 3449 views)

Last edited by Rollin_Again; 31-Jul-2006 at 04:59 PM..
eathen's Avatar
eathen eathen is offline
Junior Member with 16 posts.
THREAD STARTER
 
Join Date: Jul 2006
Experience: Einstein
02-Aug-2006, 12:44 AM #13
Thank you again Rollin_Again for you input for my thread.
Rollin_Again's Avatar
Member with 4,694 posts.
 
Join Date: Sep 2003
Location: Atlanta, GA - Planet Earth
Experience: Advanced
02-Aug-2006, 08:29 AM #14
Glad to help!! Did you download the zip file I attached to my last post? It is a sample word document that does exactly what you want and you can just click on the folder you want to print from.

Rollin
peglar's Avatar
peglar peglar is offline
Junior Member with 6 posts.
 
Join Date: Apr 2007
18-Apr-2007, 09:51 AM #15
I have tried your word doc macro and it almost does exactly what i require, however i am trying to do this with html files and although it prints them word is formatting them to have odd spacing etc.

would it be possible to do this as a standalone .exe?

my knowledge of VB is appaling at best.
As Seen On

BBC, Reader's Digest, PC Magazine, Today Show, Money Magazine
WELCOME TO TECH SUPPORT GUY!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.


(clock)
THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


WELCOME
You Are Using: Server ID
Trusted Website Back to the Top ↑