Results 1 to 10 of 10

Thread: Macro to export all publisher pages as individual jpg or png

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #8
    VBAX Newbie
    Joined
    Jun 2016
    Posts
    1
    Location
    Quote Originally Posted by jsherk View Post
    I posted this code about 6 years ago, and had completely forgotten about it, so thanks for the thank you!! Glad it worked for you!
    Thank you, this post has been very useful to me too. It gave me the basic knowledge about objects and function then I made a few changes :
    Sub SaveAsPNG()
    Dim oPage As Page
    Dim sBaseFileName As String
    Dim sPageFileName As String
    Dim bViewTwoPageSpread As Boolean
    bViewTwoPageSpread = ActiveDocument.ViewTwoPageSpread
    ActiveDocument.ViewTwoPageSpread = False
    sBaseFileName = ActiveDocument.FullName
    sBaseFileName = Left(sBaseFileName, InStrRev(sBaseFileName, ".pub", -1, vbTextCompare) - 1)
    For Each oPage In ActiveDocument.Pages
        sPageFileName = sBaseFileName & "_Page" & Right("000" & oPage.PageNumber, 3) & ".png"
        oPage.SaveAsPicture sPageFileName, pbPictureResolutionCommercialPrint_300dpi
    Next oPage
    ActiveDocument.ViewTwoPageSpread = bViewTwoPageSpread
    End Sub
    Every PNG picture is saved in the same folder as the publisher document using the same name adding "_Pagennn.png".
    Last edited by Aussiebear; 04-09-2023 at 04:30 PM. Reason: Remove extra whitespace

Posting Permissions

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