Consulting

Results 1 to 7 of 7

Thread: Print all slides in a PPT

  1. #1
    VBAX Newbie
    Joined
    Apr 2005
    Posts
    4
    Location

    Print all slides in a PPT

    Hi I am having problem with such an easy thing as printing....

    I have placed a textbox in my slide master and that triggers an action that runs a macro so a user can print when they are in slide show mode.

    I have succeded to print, but my functions gives me only one page not the complete presentation.

    Anyone that could give me something on this one?

    Thanks!

    Daniel

    ------ some example code-------

    Sub PrintPPT()
        Dim AppPPT As Object
        Set AppPPT = CreateObject("PowerPoint.Application")
        AppPPT.Visible = True
        ' If you want to hide the PowerPoint Window, set the visible property
        ' to FALSE  and WithWindow argument of Open method to FALSE too.
        With AppPPT.Presentations.Open("c:\sample.ppt")
       DoEvents
       ' Use .PrintOptions property to specify any additional settings
       ' Set background printing off else, PowerPoint will terminate before printing is completed.
       .PrintOptions.PrintInBackground = False
       .PrintOut
       .PrintOptions.PrintInBackground = True
        End With
        AppPPT.Quit
        Set AppPPT = Nothing
    End Sub
    Last edited by Aussiebear; 04-13-2023 at 12:20 AM. Reason: Adjusted the code tags

  2. #2
    VBAX Master Killian's Avatar
    Joined
    Nov 2004
    Location
    London
    Posts
    1,132
    Location
    Hi Daniel and welcome to VBAX

    The PrintOut method takes optional paramaters, so you can define what to print e.g.[VBA]ActivePresentation.PrintOut From:=2, To:=5, Copies:=2, Collate:=msoFalse[/VBA]
    K :-)

  3. #3
    VBAX Mentor
    Joined
    Sep 2004
    Location
    Nashua, NH, USA
    Posts
    489
    Location
    Try

    Sub PrintPPT() 
    Dim AppPPT As Powerpoint.Application
    Set AppPPT = new PowerPoint.Application
    with AppPPT
        .Visible = True 
        with .Presentations.Open("c:\sample.ppt") 
            .PrintOptions.PrintInBackground = False 
            .PrintOut 
        end with
        .Quit
     End With 
     set AppPPT = nothing
    End Sub
    Last edited by Aussiebear; 04-13-2023 at 12:21 AM. Reason: Adjusted the code tags

  4. #4
    VBAX Newbie
    Joined
    Apr 2005
    Posts
    4
    Location
    Thanks! But I still can't print it the way I want.... can it be anything strange with the PPT? Must check the printer as well.....

    This is strange.....

  5. #5
    VBAX Newbie
    Joined
    Apr 2005
    Posts
    4
    Location
    Hi again, tried with another PPT and it worked! Great.... but what on earth could be wrong with my first PPT?

    I see a breakthrough.... coming soon!

  6. #6
    VBAX Newbie
    Joined
    Apr 2005
    Posts
    4
    Location
    Yes!

    ActivePresentation.PrintOut From:=1, To:=all, Copies:=1, Collate:=msoFalse


    Worked fine..... halleluja!

    Thanks again!
    Last edited by Aussiebear; 04-13-2023 at 12:21 AM. Reason: Added code tags

  7. #7
    VBAX Master Killian's Avatar
    Joined
    Nov 2004
    Location
    London
    Posts
    1,132
    Location
    Cool!

    Gald you got it working
    (I've marked the thread "Solved")
    K :-)

Posting Permissions

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