+ Reply to Thread
Results 1 to 8 of 8

print external documents

  1. #1
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    2,028

    print external documents

    Hi all,
    Thanks to Greg M for the great solution provided to me! I can print docx files as I want to!
    http://www.excelforum.com/excel-prog...documents.html
    When I said that's everything is ok, my boss asked me it to add more documents to be printed.
    If possible to print additionally ".pdf" file(s) and any other pdf or docx if they are in the same row?

    The scenario is: (test file attached)
    Hi all,

    I need your help guys!
    In sheet1 I have stations in cells B:F
    In sheet1 I have button for printing specific sheets.
    In sheet Airport column A I have stations also, In column B, C or D the path for additional documents I want to be printed.

    What I need is:
    LHR (sheet Airport column A) is matching with LHR (Sheet1 F2) somehow to print the document from column B, C or D when I hit the button1 sheet1
    FRA (sheet Airport column A) is matching with FRA (Sheet1 D3 somehow to print the document from column B, C or D when I hit the button2 sheet1
    MUC (sheet Airport column A) is matching with MUC (Sheet1 B4) somehow to print the document from column B, C or d ...

    I really appreciate your help!
    Attached Files Attached Files
    Regards, John55
    If you have issues with Code I've provided, I appreciate your feedback.
    In the event Code provided resolves your issue, please mark your Thread as SOLVED.
    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

    ...enjoy -funny parrots-

  2. #2
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: print external documents

    Hi again John,

    Sorry for the delay in replying to the private message you sent me regarding this.

    The attached workbook contains a modified version of the original "PrintSpecificDocument" routine - this allows you to specify hardcopy and/or PDF versions of the selected Word document.

    Please Login or Register  to view this content.
    Hope this helps - as always, please let me know how you get on.

    Regards,

    Greg M
    Attached Files Attached Files

  3. #3
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    2,028

    Re: print external documents

    Hi Greg!
    Thank you very much for your solution! It might work but now I have an issue and I hope to solve it!
    I save/print pdf a lot of files (even if I do it this time I receive this error
    Please Login or Register  to view this content.
    "can't find project or library"- I checked references and is ticked Missing Microsoft Word 15 Object Library
    I replaced "wdExportFormatPDF" with "Type:=xlTypePDF" and the next error is "wdExportOptimizeForPrint"-can't find project...,
    I deleted it (lol!) and the next error is "wdExportAllDocument" can't find project..
    Have you any idea?
    Thanks a lot!

  4. #4
    Forum Expert
    Join Date
    06-25-2009
    Location
    Sofia, Bulgaria, EU
    MS-Off Ver
    Excel 2003-2013
    Posts
    1,290

    Re: print external documents

    These are Word enumerated constants. They are unknown to excel (they are not part of excel object model) as you use late binding. One option would be to use early binding (and also change the way you create the Word Application object), the other - to use number value (e.g. 17 instead of wdExportFormatPDF), instead of enumerated constants.
    If you are pleased with a member's answer then use the Star icon to rate it.

  5. #5
    Forum Expert
    Join Date
    06-25-2009
    Location
    Sofia, Bulgaria, EU
    MS-Off Ver
    Excel 2003-2013
    Posts
    1,290

    Re: print external documents

    I opened the file and actually you are already have reference to word object model, but not really using early binding. I change few things accordingly (marked in red)

    Please Login or Register  to view this content.
    Last edited by buran; 09-07-2015 at 08:43 AM.

  6. #6
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    2,028

    Re: print external documents

    Hi buran,
    thank you!
    the code is running 2-3 min and then pops up this error "Microsoft office Excel is waiting for another application to complete an OLE action"
    and even I click ok the code runs continuously... what should I do?

  7. #7
    Forum Expert
    Join Date
    06-25-2009
    Location
    Sofia, Bulgaria, EU
    MS-Off Ver
    Excel 2003-2013
    Posts
    1,290

    Re: print external documents

    I didn't have time to go in detail of all the code. It's a spaghetti code, but obviously it must wait for Word to complete some operation. I just fixed the reference to Word enumeration and early/late binding mix in the code. Greg may be of more help here.

  8. #8
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    2,028

    Re: print external documents

    it's ok! thank you!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. External word documents last saved date in Excel cells.
    By tazman_il in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 03-25-2024, 10:28 PM
  2. [SOLVED] match and print additional(external) documents
    By john55 in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 07-27-2015, 06:17 PM
  3. [Excel 2010] Performance issues scanning external documents for text
    By Prejdickty in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-08-2014, 09:00 AM
  4. How can I import file information from external documents?
    By zeppelin150 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-31-2014, 12:31 PM
  5. [SOLVED] Links to external documents
    By Emily Edgington in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-10-2006, 09:45 AM
  6. [SOLVED] compare cells of different external documents
    By VC++User in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-01-2006, 09:15 AM
  7. Replies: 1
    Last Post: 03-01-2005, 10:06 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1