+ Reply to Thread
Results 1 to 5 of 5

Move paragraph of a word document to start of next page through Excel VBA

  1. #1
    Registered User
    Join Date
    12-22-2013
    Location
    Delhi, India
    MS-Off Ver
    Excel 2010
    Posts
    47

    Move paragraph of a word document to start of next page through Excel VBA

    Hi Friends,

    Is there a way to move paragraph of a word document to start of next page.

    I know how to control word document from excel and paste any information from excel to word, but and able to move paragraph to start of next word page. Can anyone you please help me on this.

    The same query is also posted in another forum
    https://chandoo.org/forum/threads/mo...cel-vba.38172/

    Regards

  2. #2
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,839

    Re: Move paragraph of a word document to start of next page through Excel VBA

    There are various ways, depending on what you want to achieve. For example, a paragraph can be formatted with the 'keep together' attribute to stop it splitting across page breaks. Similarly, a paragraph can be formatted with the 'keep with next' attribute to ensure a heading, for example, remains on the same page as the first paragraph that follows it. These settings can be used together or in isolation. With headings, in particular, the 'keep with next' attribute might be applied to the relevant heading Style so it becomes automatic. If that's not what you want to do, you'll need to provide more information.
    Cheers,
    Paul Edstein
    [Fmr MS MVP - Word]

  3. #3
    Registered User
    Join Date
    12-22-2013
    Location
    Delhi, India
    MS-Off Ver
    Excel 2010
    Posts
    47

    Re: Move paragraph of a word document to start of next page through Excel VBA

    Thank you macropod for your reply,

    For easy understanding, i have attached the word document in which the VBA code will run from Excel should run.

    Steps which i am following:
    Files used:-
    a) Excel File - With table to be copied from
    b) Word template - Copied table to be pasted (attached with this post "Letter Template). Also for easy understanding i have also attached a word template with the table Name "Letter Template 2"

    - The VBA code will run from Excel -> Copy the table from Excel -> paste in Word Doc -> Move the "APPENDIX: DOCUMENT" in word template to start of second page.

    The position of "APPENDIX: DOCUMENT" keeps of changing as for some employees tables rows are less or more (number of rows are not constant). hence for each employee's letter position of "APPENDIX: DOCUMENT" changes.

    Hence using code i want to move all the text staring from "APPENDIX: DOCUMENT" to second page
    I know how to copy paste excel to word document, but not able to move the section as mentioned above to second page. Can you please help me on this,Do let me know if you need any other information.

  4. #4
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,839

    Re: Move paragraph of a word document to start of next page through Excel VBA

    Instead of using empty paragraphs to try to push the "APPENDIX: DOCUMENT" content down to the second page, insert a manual page break before it in your 'template'. No code required. This is basic document formatting stuff; you should learn how to use Word. As it is, your 'template' isn't a Word template at all (it's a document), you've tried to format it by overriding the format of the 'Normal' Style with whatever takes your fancy instead of creating/using Styles for the job, and the DATE field in the header is liable to update every time the document is opened (if you used a proper Word template with a CREATEDATE field there, that wouldn't be an issue).

  5. #5
    Registered User
    Join Date
    12-22-2013
    Location
    Delhi, India
    MS-Off Ver
    Excel 2010
    Posts
    47

    Re: Move paragraph of a word document to start of next page through Excel VBA

    Thanks macropod,

    My problem is solved with Page break

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Excel VBA using Paragraph Right Indent in Word Document
    By brajpalshishodia in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-31-2017, 09:48 AM
  2. Embed a 2+ page word document into Excel 2013?
    By CakeMish in forum Excel General
    Replies: 4
    Last Post: 09-21-2015, 07:43 AM
  3. Delete all Paragraph in a Word document containing a particular inlineshape using VBA
    By sshishirkumar in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-15-2015, 05:28 AM
  4. Excel to Word- paragraph and page setup
    By MWXA in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 09-08-2011, 11:50 AM
  5. move to a unique point in Word document from excel
    By pooley343 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-21-2011, 12:02 PM
  6. [SOLVED] How do I embed a two page word document in excel
    By GregM in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 07-12-2006, 11:30 PM
  7. move multi-page Excel worksheet into Word document
    By cedarville in forum Excel General
    Replies: 1
    Last Post: 01-02-2006, 10:10 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1