Results 1 to 3 of 3

Thread: how do i print all files in a folder?

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2001
    Posts
    8

    how do i print all files in a folder?

    hi,
    i'm new to vb programming, and i was wondering if anyone could help me out. just like the subject says, i want to print all the files of a certain filetype in a folder to a certain printer. my pseudocode thus far looks like this:

    'start pseudocode
    vars&stuff
    input dir
    output doc dir
    error doc dir
    output pdf dir
    default printer
    desired printer (acrobat distiller)
    array for filenames

    find default printer
    change default to distiller
    create array of docs in input dir
    open word
    for
    open doc
    print to printer
    ?
    if no error log move to done folder
    else move to error folder
    ?
    close doc
    end
    restore default printer
    'end pseudocode

    like i said, i'm new at this, so i'm still getting used to vb syntax. anyway, my main problems-- how to change the printer, how to loop (something like "For Each file in folder"?). any help would be appreciated.

    -j-

  2. #2
    jim mcnamara
    Guest
    This is how to find files of all one type in a folder:

    http://www.vbforums.com./showthread....threadid=96116

    This enumerates (shows) all printers
    Code:
    Dim oPtr as Object
    For each oPtr in Printers
          msgbox oPtr.DeviceName, vbokonly
    next
    Assuming it's a text file this prints the file
    Code:
    open filename for input as #1
    Do while not eof(1)
           line input #1, a$
           Printer.Print a$
    Loop
    Printer.EndDoc
    You use the common dialog control with .showprinter to select which printer you want to use.

    Printing pdf's is a whole 'nother problem. Do a search on this forum (not just api) for pdf. Basically you have to automate Acrobat to print a pdf file.

  3. #3

    Thread Starter
    New Member
    Join Date
    Aug 2001
    Posts
    8
    thx jim;
    actually, i'm not trying to print pdfs. i'm just sending my print jobs to acrobat distiller so it outputs pdfs-- i'm probably going to use shellexecute to have my files print.


    thx again
    -j-

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width