Results 1 to 3 of 3

Thread: Printing Word Documents based on Excel Sheet
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    New Member
    Join Date
    Nov 2010
    Post Thanks / Like
    0 Post(s)
    0 Thread(s)

    Default Printing Word Documents based on Excel Sheet


    Bit of a shot in the dark here, but know that this is likely the best possible resource to ask.

    My department admins have a lot of documents to print every week for various other departments, and printing these out is not only tedious and labour intensive - but open to errors and missed documents.

    I was wondering if it was possible to use both VBA and Excel to take the risk of error, and the labour, out of the task.

    Is it possible to have an Excel Spreadsheet listing the documents that need printing, with the folder location, and the number of copies - then having VBA work down the list opening, printing and closing each one?

    For example:

    A B C D
    1 Document Name Location # Copies
    2 Document 1.docx C:\Folder\ 30
    3 Document 2.docx C:\Folder6\ 50

    Is this something that can be done?

    I would like to be able to update the list of documents if and when needed, and the VBA Button to go down the list until there is nothing left to process, printing the documents with the number of copies stipulated in the Worksheet.

    At the moment, it is just an idea - so I haven't done much research on this. But if someone could tell me if this is possible, I would really appreciate it.



  2. #2
    Board Regular Johnny C's Avatar
    Join Date
    Nov 2006
    Liverpool, UK
    Post Thanks / Like
    4 Post(s)
    0 Thread(s)

    Default Re: Printing Word Documents based on Excel Sheet

    Try here

    Put the loop to loop through your cells in this bit:
    Set objDoc = objWord.Documents.Open("C:\Test\SomeDocument.docx")
    ' Step 3 -- in this case, print out the document without any prompts
    My Excel is tied up at the moment but there's probably a 'Copies:=' parameter

    StackOverflow is a better resource for questions like that, as switching between Office apps using VBA has a lot of technical niggles.

    One of which might be timing in this instance, if it takes word some time to print 50 copies, you might need to hard code a delay
    For i = 1 to 5000: DoEvents: Next i
    as Excel and Word are different processes and Excel won't wait for Word to finish, it just sends the command to the Word instance and ploughs on with the Excel VBA.
    Last edited by Johnny C; Jul 2nd, 2019 at 11:25 AM.
    "If you think this Universe is bad, you should see some of the others" - Philip K. DiĘk

  3. #3
    Board Regular
    Join Date
    Jul 2014
    Memphis, TN
    Post Thanks / Like
    11 Post(s)
    1 Thread(s)

    Default Re: Printing Word Documents based on Excel Sheet

    From a recording of a printing in Word...
    If you leave out the ActivePrinter it will print to the default or last printer used in Word.

    ActivePrinter = "PH90000_011"
    Application.PrintOut FileName:="", Range:=wdPrintAllDocument, Item:= _
            wdPrintDocumentContent, Copies:=19, Pages:="", PageType:=wdPrintAllPages, _
             Collate:=True, Background:=True, PrintToFile:=False, PrintZoomColumn:=0, _
             PrintZoomRow:=0, PrintZoomPaperWidth:=0, PrintZoomPaperHeight:=0
    Replace Application with objDoc (?)
    Excel 2013, 2016 with PowerBI
    Knowing that it can be done is half the battle!

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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