Consulting

Results 1 to 11 of 11

Thread: How to interchange of any 2 pages?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    How to interchange of any 2 pages?

    Hi,


    Suppose I want to swap Page 3 with Page 6,


    is there a convenient to do so, instead of using copy & paste?




    Thanks.

  2. #2
    There are no pages in a Word document. It is not a page layout application. Displayed 'pages' are also made up of several overlaid layers or story ranges which make up the results you see. Copying the content of a 'page' to another location is not a straightforward task and much depends on what is actually in the document and what associated elements need to be moved also.
    Graham Mayor - MS MVP (Word) 2002-2019
    Visit my web site for more programming tips and ready made processes
    http://www.gmayor.com

  3. #3
    Microsoft Word MVP 2003-2009 VBAX Guru gmaxey's Avatar
    Joined
    Sep 2005
    Posts
    3,334
    Location
    Graham is correct. In many many cases this just can't be done or if can it would take more effort to code than it is worth. However, just for the sake of demonstration, in a basic document e.g., no drawings, textboxes, headers, footers, textboxes, footnotes etc, you can have "limited" success using the .Panes, .Pages and .Rectangle objects of the document.

    For example, if you had a "5" page document where pages 1 though 4 have defined text (anything even empty paragraphs) filling the complete page, then you could reverse the order of pages 1-4 to display the text 4-1

    Sub ScratchMacro()
    Dim oDoc As Document
    Dim oDocSP As Document
      Set oDoc = ActiveDocument
      Set oDocSP = Documents.Add(ActiveDocument.FullName)
      oDoc.Activate
      With ActiveDocument.ActiveWindow.Panes(1)
        .Pages(1).Rectangles(1).Range.FormattedText = oDocSP.ActiveWindow.Panes(1).Pages(4).Rectangles(1).Range.FormattedText
        .Pages(2).Rectangles(1).Range.FormattedText = oDocSP.ActiveWindow.Panes(1).Pages(3).Rectangles(1).Range.FormattedText
        .Pages(3).Rectangles(1).Range.FormattedText = oDocSP.ActiveWindow.Panes(1).Pages(2).Rectangles(1).Range.FormattedText
        .Pages(4).Rectangles(1).Range.FormattedText = oDocSP.ActiveWindow.Panes(1).Pages(1).Rectangles(1).Range.FormattedText
      End With
      oDocSP.Close wdDoNotSaveChanges
    lbl_Exit:
      Set oDoc = Nothing: Set oDocSP = Nothing
      Exit Sub
    End Sub
    Greg

    Visit my website: http://gregmaxey.com

  4. #4
    Banned VBAX Newbie
    Joined
    Sep 2019
    Posts
    2
    Location
    IF you don't know the answer then you have no right to mislead our forum members.

  5. #5
    Quote Originally Posted by James45 View Post
    IF you don't know the answer then you have no right to mislead our forum members.
    It seems very odd that you should use your first post to the forum to criticise replies on a subject you clearly know nothing about.
    Graham Mayor - MS MVP (Word) 2002-2019
    Visit my web site for more programming tips and ready made processes
    http://www.gmayor.com

  6. #6
    Banned VBAX Newbie
    Joined
    Sep 2019
    Posts
    2
    Location
    Quote Originally Posted by gmayor View Post
    It seems very odd that you should use your first post to the forum to criticise replies on a subject you clearly know nothing about.

    https://cardgenerator.io/mastercard-credit-card-generator/
    I was just trying to impress you. I think you are impressed with my answer sir?

  7. #7
    Microsoft Word MVP 2003-2009 VBAX Guru gmaxey's Avatar
    Joined
    Sep 2005
    Posts
    3,334
    Location
    Agreed.
    Greg

    Visit my website: http://gregmaxey.com

  8. #8
    VBAX Tutor
    Joined
    Jul 2016
    Posts
    266
    Location
    LOL I doubt that.

    What the heck is that credit card generator link doig in his quote?
    Last edited by Kilroy; 09-19-2019 at 07:05 AM.

  9. #9
    VBAX Newbie
    Joined
    Oct 2021
    Location
    Chicago
    Posts
    1
    Location
    Quote Originally Posted by Kilroy View Post
    LOL I doubt that.

    What the heck is that link doing in his quote?


    You can create a debit card by trying a real free credit card numbers generator.
    Last edited by Aussiebear; 10-16-2021 at 12:11 PM. Reason: Removed link

  10. #10
    Banned VBAX Newbie
    Joined
    Oct 2021
    Posts
    2
    Location
    Thanks a lot for information! I was searching similar solution

  11. #11
    VBAX Contributor
    Joined
    Jul 2020
    Location
    Sun Prairie
    Posts
    118
    Location
    Not a vba solution but using the Navigation Pane, you can move sections which use headings.
    Moving/Reorganizing Pages in Microsoft Word

Posting Permissions

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