Results 1 to 2 of 2

Thread: Help with printing macro - -please!!!

  1. #1

    Unhappy Help with printing macro - -please!!!

    Hi all, I have posted on several boards and have not recieved a response -- please help if you can?

    I am wanting to develop a macro for excel which will read (from a worksheet) a list of hyperlinks to .pdf, .doc, and .xls files and print them using the appropriate application. Theoretically, I know I would have to use some kind of for-next and/or case structure but I don't know how to implement it. Someone has helped me get started, but the macro I have only works for the word documents. Here is the code I have:

    Sub PrintDocuments() 
    'Must set a reference (Tools | References) to: 
    ' Microsoft Word 11.0 Object Library 
    '11.0 = 2003, 10.0 = 2002 (XP), 9.0 = 2000, etc. 
    Dim WDApp As Word.Application, WDDoc As Word.Document 
    Dim c As Range, rngFiles As Range 
    Set rngFiles = Range("A2", Cells(Rows.Count, "A").End(xlUp)) 
    Set WDApp = New Word.Application 
    WDApp.Visible = True 
    For Each c In rngFiles 
    Set WDDoc = WDApp.Documents.Open(c.Value) 
    WDDoc.PrintOut copies:=1 
    WDDoc.Close False 
    Set WDDoc = Nothing 
    Next c 
    WDApp.Quit False 
    Set WDApp = Nothing 
    End Sub

    And here is a sample of the file list, which will change in contents and number of elements:

    C:\Project Books\Templates\Clearance Sheets\BrgThrust&JournalClr.doc
    C:\Project Books\Templates\Clearance Sheets\BrgThrust.doc
    C:\Project Books\Templates\Clearance Sheets\BrgThrustPadInsp.pdf
    C:\Project Books\Templates\Clearance Sheets\RotorAxialPosition.xls
    C:\Project Books\Templates\Clearance Sheets\RotorAxPosThrustClr.doc

    If you can help, I'd be forever indebted.

  2. #2
    Moderator VBAX Master austenr's Avatar
    Sep 2004
    Cross Post on Ozgrid and probably others:

    The likely reason you are not getting replies is that you have this question posted in numerous forums. Its not that people are avoiding you but are reluctant to help you because like I most people that visit this board, they visit other boards as well. If they see this exact question posted in other forums it makes them reluctant to try to help because they feel they may be wasting their time as there may be someone helping you on another board that they do not know of.

    Everyone at VBAX likes to help others and there are some AWSOME resources here. If you have posted your question on other boards, please as a courtesy, provide a link to those other boards so others can see if there has been any answers to your question. This helps everyone and will help you get the problem you have solved.
    Peace of mind is found in some of the strangest places.

Posting Permissions

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