none
Print to PDF RRS feed

  • Question

  • I'm in Word 2011 on mac. I need a macro that will print the current page of a document to a PDF. Any help would be appreciated.

    Thanks!

    Wednesday, January 11, 2012 3:17 PM

All replies

  • Sub SendPageToPdf()
    Dim lngPageNo As Long

    lngPageNo = Selection.Information(wdActiveEndPageNumber)

      ActiveDocument.ExportAsFixedFormat _
        OutputFileName:="Standard Name" & CStr(lngPageNo) & ".pdf", _
        ExportFormat:=wdExportFormatPDF, _
        OpenAfterExport:=True, _
        OptimizeFor:=wdExportOptimizeForPrint, _
        Range:=wdExportCurrentPage
       
    End Sub


    Ed Ferrero
    www.edferrero.com
    Thursday, January 12, 2012 12:24 AM
  • Hi DebateHillman,

     

    Check also this thread out by reported bug, maybe its already resolved by now, just for your info:

    http://groups.google.com/group/microsoft.public.mac.office.word/browse_thread/thread/ef842516e9339ff2

    P.S. Thanks for the notification Ed, I had two simular threads, one Excel and one in Word, so got confused.

     

    Hope this helps

     


    Daniel van den Berg | Washington, USA | "Anticipate the difficult by managing the easy"
    Thursday, January 12, 2012 6:13 AM
    Moderator
  • I tried it. It compiles fine, but when I try to run it it comes up with a Run-time error that says "Object doesn't support this property or method.
    Thursday, January 12, 2012 7:13 PM
  • I should have mentioned, it's referring to the Range:=wdExportCurrentPage
    Thursday, January 12, 2012 7:18 PM
  • Hmm tried the code myself its running well, but that's in Windows, I am not sure why it will not work in Mac.

     

    What if you tried the numeric equivelant, so the code will be like this:

    Sub Test()
    
    Dim lngPageNo As Long
    
    lngPageNo = Selection.Information(wdActiveEndPageNumber)
    
      ActiveDocument.ExportAsFixedFormat _
        OutputFileName:="Standard Name" & CStr(lngPageNo) & ".pdf", _
        ExportFormat:=wdExportFormatPDF, _
        OpenAfterExport:=True, _
        OptimizeFor:=wdExportOptimizeForPrint, _
        Range:=2
    
    End Sub
    



    Daniel van den Berg | Washington, USA | "Anticipate the difficult by managing the easy"
    Thursday, January 12, 2012 10:48 PM
    Moderator
  • Dear DebateHillman,

     

    How about the problem on your side? Do you still need any assistant about the problem? If you still show any concern on the problem, just feel free to let us know.
     

    Best Regards,

     


    Daniel van den Berg | Washington, USA | "Anticipate the difficult by managing the easy"
    Wednesday, January 18, 2012 7:18 PM
    Moderator