+ Reply to Thread
Results 1 to 11 of 11

Print word document from Excel

  1. #1
    Forum Contributor
    Join Date
    05-13-2013
    Location
    Swindon UK
    MS-Off Ver
    Excel 2010
    Posts
    277

    Print word document from Excel

    Hi

    I have an excel userform which will print out some excel documents for me , however there is some word docs that i need to print to.

    I have used the code below but it keeps stopping on the .print line of code, can anyone help please


    Please Login or Register  to view this content.

  2. #2
    Forum Contributor
    Join Date
    05-13-2013
    Location
    Swindon UK
    MS-Off Ver
    Excel 2010
    Posts
    277

    Re: Print word document from Excel

    Hi

    Sorry i forgot, i could also do with a code that will print out a .pdf file too, can anyone help with this please

    Thank you

  3. #3
    Forum Contributor
    Join Date
    09-03-2015
    Location
    IE
    MS-Off Ver
    2003 - 2016
    Posts
    258

    Re: Print word document from Excel

    It probably 'stops' as the Path property of the Active workbook does not include a trailing '\' so it is looking for a file called (for example) 'c:\tempW.SES-2.09.00Att02.doc'

  4. #4
    Forum Contributor
    Join Date
    05-13-2013
    Location
    Swindon UK
    MS-Off Ver
    Excel 2010
    Posts
    277

    Re: Print word document from Excel

    HI

    I also tried this but still no joy

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    05-13-2013
    Location
    Swindon UK
    MS-Off Ver
    Excel 2010
    Posts
    277

    Re: Print word document from Excel

    Anyone able to help me with this please

    Thank you

  6. #6
    Forum Expert CheeseSandwich's Avatar
    Join Date
    12-22-2021
    Location
    Kent, England
    MS-Off Ver
    365 - 2404-17531.20128
    Posts
    1,361

    Re: Print word document from Excel

    Is it stopping on the below line?
    Please Login or Register  to view this content.
    Is the file a '.doc' or '.docx'?

    When I change what you have to a '.docx' and set my default printer it seems to work just fine.
    If things don't change they stay the same

  7. #7
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: Print word document from Excel

    The basic code looks OK, but perhaps you need some error-checking:
    Please Login or Register  to view this content.
    Also, depending on the type of document, Word may also be waiting for you to provide some input. If it's opening a mailmerge main document, for example, Word would be waiting for you to respond to the SQL prompt. If the document contains FILLIN or ASK fields, those might require a user response before Word can proceed.
    Cheers,
    Paul Edstein
    [Fmr MS MVP - Word]

  8. #8
    Forum Contributor
    Join Date
    05-13-2013
    Location
    Swindon UK
    MS-Off Ver
    Excel 2010
    Posts
    277

    Re: Print word document from Excel

    HI

    Thank yo for the reply, i have tried your code but now i get an error " user-defined type not defined"

    and the code stop on line

    Dim wdApp As New Word.Application, wdDoc As Word.Document

  9. #9
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: Print word document from Excel

    And did you set the required reference - as specified in your own code???

  10. #10
    Forum Contributor
    Join Date
    05-13-2013
    Location
    Swindon UK
    MS-Off Ver
    Excel 2010
    Posts
    277

    Re: Print word document from Excel

    Quote Originally Posted by macropod View Post
    And did you set the required reference - as specified in your own code???
    No i don't think so, i just copied the code, what else do i need to do here,?? not sure i understand "set the required reference"

  11. #11
    Forum Contributor
    Join Date
    05-13-2013
    Location
    Swindon UK
    MS-Off Ver
    Excel 2010
    Posts
    277

    Re: Print word document from Excel

    Hi

    Sorry i know what you mean now lol, i did set this on my own pc but not on my works laptop, i have now done that and is now working as i want it too,

    Thank you for your help here

+ 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. Replies: 5
    Last Post: 10-10-2021, 11:49 PM
  2. Excel Macro to open and print word document
    By madhatter40 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-27-2017, 01:26 PM
  3. [SOLVED] I am trying to print a word document from a Excel spreadsheet.
    By starlev in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-20-2015, 09:45 AM
  4. With excel to print a selected page from a word document
    By eb4927 in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 09-15-2014, 05:54 PM
  5. Replies: 1
    Last Post: 01-30-2014, 05:38 PM
  6. Print off the word document using excel vba code
    By aman1234 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-17-2013, 09:42 AM
  7. Replies: 0
    Last Post: 08-19-2009, 12:47 PM

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