none
PowerPoint VBA : double sided printing RRS feed

  • Question

  • Hi,

    I would like to create a macro from PPT for printing the presentation with "double sided printing".

    Your help will be appreciated.

    Thanks

     


    Best Regards Jun LOU
    Wednesday, November 23, 2011 2:31 PM

Answers

  • Jun, I tested on my side, but it works well. I am not very sure what is wrong on your side? Did you encountered errors in Powerpoint 2010, if so, could you show us the detailed information. Besides, in order to save macro in Powerpoint 2010, we need to save it as pptm.

    Best Regards,


    Bruce Song [MSFT]
    MSDN Community Support | Feedback to us
    • Marked as answer by Jun LOU Friday, December 16, 2011 1:13 PM
    Wednesday, November 30, 2011 8:51 AM

All replies

  • Hi Jun LOU,

    Thank you for posting.

    As for the problem, please refer to this thread about setting duplex printing:

    http://www.ozgrid.com/forum/showthread.php?t=82604

    Hope this can help you and just feel free to follow up after you have tried.

    Best Regards,

     


    Bruce Song [MSFT]
    MSDN Community Support | Feedback to us
    Friday, November 25, 2011 4:22 AM
  • Thanks Bruce Song,

    I've already visited the above website.

    The website is really useful for me it's the following Microsoft site :

    http://www.microsofttranslator.com/BV.aspx?ref=CSSKB&lo=SS&from=en&to=fr&a=http://support.microsoft.com/kb/230743/en-us?fr=1

    It's working on my Word2010. The code create a new Word document, write some texte on the page 1 & 2 and then print it by using duplex sided printing.

    Now, I need to find how to print an existing file and using Powerpoint in stead of Word.

    Thank you for your help

     

    Private Sub CommandButton1_Click()
     
     
          Dim oWord As Object
          Dim oDoc As Object
         
          Set oWord = CreateObject("Word.application")

          oWord.Visible = True
         
          Set oDoc = oWord.Documents.Add
          oDoc.Range.Select

          oWord.Selection.TypeText "This is on page 1" & vbCr
          oWord.Selection.InsertBreak 1
          oWord.Selection.TypeText "This is page 2"
         
          SetPrinterDuplex "\\parsrv01\PARPRCAN0106", 2
         
          oDoc.PrintOut Background:=False
         
          SetPrinterDuplex "\\parsrv01\PARPRCAN0106", 1
         
          MsgBox "Print Done", vbMsgBoxSetForeground
         
          oDoc.Saved = True
          oDoc.Close
          Set oDoc = Nothing
      
          oWord.Quit
          Set oWord = Nothing

     
    End Sub


    Best Regards Jun LOU
    Friday, November 25, 2011 12:02 PM
  • Jun LOU, as far as I know, the Presentation object contains the method PrintOut:

    http://msdn.microsoft.com/en-us/library/bb251343(v=office.12).aspx

    So, I think you can just use the following code snippet:

    Private Sub CommandButton1_Click()
          SetPrinterDuplex "\\parsrv01\PARPRCAN0106", 2
          ActivePresentation.PrintOut
          SetPrinterDuplex "\\parsrv01\PARPRCAN0106", 1
          MsgBox "Print Done", vbMsgBoxSetForeground
    End Sub

    Hope this can help you and just feel free to follow up after you have tried.

    Best Regards,


    Bruce Song [MSFT]
    MSDN Community Support | Feedback to us
    Tuesday, November 29, 2011 10:59 AM
  • Hi Bruce,

    I've already tried it. In fact, it works under Powerpoint 2003, but not under PPT 2010.

    I couldn't ask our user to install PPT2003 for running my macro :)

    Thank you for your help

    Jun

     

    Option Explicit

    Private Sub Double_Sided()

    Dim oDoc As Object


    Set oDoc = ActivePresentation

    SetPrinterDuplex "\\parsrv01\PARPRCAN0106", 2

    oDoc.PrintOut
    'SetPrinterDuplex "\\parsrv01\PARPRCAN0106", 1

    'MsgBox "Print Done", vbMsgBoxSetForeground

    'oDoc.Saved = True
    'oDoc.Close
    Set oDoc = Nothing

    End Sub


    Best Regards Jun LOU
    Tuesday, November 29, 2011 4:21 PM
  • Jun, I tested on my side, but it works well. I am not very sure what is wrong on your side? Did you encountered errors in Powerpoint 2010, if so, could you show us the detailed information. Besides, in order to save macro in Powerpoint 2010, we need to save it as pptm.

    Best Regards,


    Bruce Song [MSFT]
    MSDN Community Support | Feedback to us
    • Marked as answer by Jun LOU Friday, December 16, 2011 1:13 PM
    Wednesday, November 30, 2011 8:51 AM