Results 1 to 13 of 13
  1. #1
    3 Star Lounger
    Join Date
    Aug 2004
    Posts
    361
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Printing agenda and all attachments (Word 2002)

    A committee members sends out via email an agenda (Word doc). Included in the agenda are a number of attachments (again Word docs). Is there a method to print the agenda along with all attachments with out having to open each attachment separately?

    I believe I saw a solution for this somewhere. Not sure if it was the Lounge or some site.

    Thanks.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Printing agenda and all attachments (Word 2002)

    In what way are the "attachments" included in the agenda if it is a Word document?

  3. #3
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Printing agenda and all attachments (Word 2002)

    I think you will need to write some VBA, something like the attached which works on a quick test, but would probably go horribly wrong if one of the attachments was already open!

    StuartR
    <code>
    Sub PrintAll()
    Dim objTemp As Shape
    Dim docTemp As Document

    ActiveDocument.PrintOut
    For Each objTemp In ActiveDocument.Shapes
    If Left(objTemp.Application, 14) = "Microsoft Word" Then
    objTemp.Activate
    Set docTemp = Application.Documents(Application.Documents.Count)
    docTemp.PrintOut
    docTemp.Close SaveChanges:=False
    End If
    Next objTemp
    Set docTemp = Nothing
    End Sub
    </code>

  4. #4
    3 Star Lounger
    Join Date
    Aug 2004
    Posts
    361
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Printing agenda and all attachments (Word 2002)

    My apologies for using the incorrect term. Instead of attachment, I should have referred to an Word object inserted into the Agenda. Each object has to be opened before it can be printed. Looking for a way to be able to print the agenda and all of the objects at one time.

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Printing agenda and all attachments (Word 2002)

    See Stuart's reply.

  6. #6
    3 Star Lounger
    Join Date
    Aug 2004
    Posts
    361
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Printing agenda and all attachments (Word 2002)

    Thanks for the code. Unfortunately, it does not appear to work. I opened the agenda placed the code into it, ran the code. When I ran the code all I get is the agenda. Did I place the code in the correct location? Thanks.

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Printing agenda and all attachments (Word 2002)

    Does this work?

    Sub PrintAll()
    Dim i As Integer
    ActiveDocument.PrintOut
    For i = 1 To ActiveDocument.InlineShapes.Count
    Select Case ActiveDocument.InlineShapes(i).Type
    Case wdInlineShapeEmbeddedOLEObject, wdInlineShapeLinkedOLEObject
    If ActiveDocument.InlineShapes(i).OLEFormat.ProgID Like _
    "Word.Document*" Then
    ActiveDocument.InlineShapes(i).Activate
    ActiveWindow.PrintOut
    ActiveWindow.Close
    End If
    End Select
    Next i
    End Sub

  8. #8
    3 Star Lounger
    Join Date
    Aug 2004
    Posts
    361
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Printing agenda and all attachments (Word 2002)

    Unfortunately not. It prints the agenda twice but none of the objects. I am including a very much cut down document to see if when you run the script you get something different.

    Once again, thanks.
    Attached Files Attached Files

  9. #9
    3 Star Lounger
    Join Date
    Aug 2004
    Posts
    361
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Printing agenda and all attachments (Word 2002)

    Thanks for the suggestion. As I mentioned in a reply below, I tried the code but it printed two copies of the agenda and did not print the embedded documents. Can you please explain what the 14 does in the following: If Left(objTemp.Application, 14) = "Microsoft Word" Then
    objTemp.Activate
    I believe that I understand your code, just not sure what the 14 does.
    Thanks.

  10. #10
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Printing agenda and all attachments (Word 2002)

    The code I posted worked in a limited test for documents embedded as documents. It doesn't work for documents embedded as icons. I don't know how to make the code work for that. I would ask the committee member to distribute the documents in a more normal manner. If that is not possible, print the embedded documents manually.

  11. #11
    3 Star Lounger
    Join Date
    Aug 2004
    Posts
    361
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Printing agenda and all attachments (Word 2002)

    Unfortunately, I do not see a module. The project explorer shows the project and then under the project, "reference to normal", and "this document". HAve I got some incorrect setting in the project explorer?

    Thanks for the information regarding 14.

    Found where to show module.

  12. #12
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Printing agenda and all attachments (Word 2002)

    To create a new, empty, module.

    In the Project Explorer window, select the document that you want the module to be part of.
    From the Insert menu, choose Module.

    StuartR

  13. #13
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts

    Re: Printing agenda and all attachments (Word 2002)

    Hans' code works for me but you need to move it into a module rather than the ThisDocument object. You can try it in a different template such as Normal but it will also work in the actual doc you posted.

    The 14 takes the leftmost 14 characters in the Application Name. This means that if the objects were placed there from various versions of Word then they will all be opened happily.
    Andrew Lockton, Chrysalis Design, Melbourne Australia

Posting Permissions

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