Results 1 to 7 of 7
  1. #1
    4 Star Lounger
    Join Date
    Jan 2002
    Location
    London, Gtr London, England
    Posts
    416
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Word State/Paging Options (WORD 97/2000)

    This may be a stupid question & if it is, my apologies for wasting your time.

    I was wondering if it is possible to

    1. Save the document state (NOT saving the document to disk) (all the paging options etc)
    2. Change paging options (margins, papersize (e.g. from A4 to US Letter) & suchlike)
    3. Print Preview the document (with new margins/papersize etc)
    4. Restore the document state prior to changes (in margins/papersize (e.g back from US Letter to A4) etc)

    It is almost like undoing all the pagesetup changes but I am hoping there is a way of doing it quickly and efficiently.

    Thanks for your time and response in advance.
    Thanks.
    Robie

  2. #2
    4 Star Lounger
    Join Date
    Dec 2000
    Location
    Quakertown, PA, Pennsylvania, USA
    Posts
    517
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Word State/Paging Options (WORD 97/2000)

    Seems to me it would be a lot easier to save the file and then, with an on-close, kill the file it saved?

  3. #3
    4 Star Lounger
    Join Date
    Jan 2002
    Location
    London, Gtr London, England
    Posts
    416
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Word State/Paging Options (WORD 97/2000)

    Thanks for the response but the document could be very large (few hundred pages) and it would be unacceptable to my users to wait for a save.

    I thought it was a stupid question but I had to ask anyway. I am sure there must be a way of doing it.

    Thanks for your time and effort
    Thanks.
    Robie

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

    Re: Word State/Paging Options (WORD 97/2000)

    Why not simply declare a variable of type PageSetup and copy all the current settings to it before making changes, then you can simply restore them afterwards.

    I have just shown a few of the things that you might want to save to give you an idea of what I mean...
    <pre>Sub PageSetupTry()
    Dim pgSaved As PageSetup
    With ActiveDocument.PageSetup
    pgSaved.BottomMargin = .BottomMargin
    pgSaved.DifferentFirstPageHeaderFooter = .DifferentFirstPageHeaderFooter
    pgSaved.FooterDistance = .FooterDistance
    pgSaved.Gutter = .Gutter
    pgSaved.GutterPos = .GutterPos
    pgSaved.GutterStyle = .GutterStyle
    pgSaved.HeaderDistance = .HeaderDistance
    pgSaved.LayoutMode = .LayoutMode
    pgSaved.LeftMargin = .LeftMargin

    <font color=448800>'Make whatever changes you want here</font color=448800>

    .BottomMargin = pgSaved.BottomMargin
    .DifferentFirstPageHeaderFooter = pgSaved.DifferentFirstPageHeaderFooter
    .FooterDistance = pgSaved.FooterDistance
    .Gutter = pgSaved.Gutter
    .GutterPos = pgSaved.GutterPos
    .GutterStyle = pgSaved.GutterStyle
    .HeaderDistance = pgSaved.HeaderDistance
    .LayoutMode = pgSaved.LayoutMode
    .LeftMargin = pgSaved.LeftMargin
    End With
    End Sub
    </pre>

    StuartR

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

    Re: Word State/Paging Options (WORD 97/2000)

    You'd have to save and restore PageSetup for each section in the document. Since Robie mentions that the documents are very large, that might mean that there are many sections... Is it possible to create an array of type PageSetup?
    And you'd have to account for users accidentally removing or adding section breaks... I think this is more complicated than it seems at first sight.

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

    Re: Word State/Paging Options (WORD 97/2000)

    An array of PageSetups is certainly valid. The issue with added section breaks depends on whether the user is going to be allowed to make edits to the document whilst the Macro is running.

    StuartR

  7. #7
    4 Star Lounger
    Join Date
    Jan 2002
    Location
    London, Gtr London, England
    Posts
    416
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Word State/Paging Options (WORD 97/2000)

    Thanks Stuart & Hans. Very useful and valid comments.

    I shall try it out over the weekend (doh!). The user will not be allowed to edit the document while the macro is running.

    Thanks once again but if any of you have any other bright ideas (I am sure you great WORD gurus do!) then please let me know.

    Thanks. Much obliged.
    Thanks.
    Robie

Posting Permissions

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