Link to home
Start Free TrialLog in
Avatar of Kaps_68
Kaps_68

asked on

paste at end of section

I want to know how to paste a table at the end of a particular section in Word e.g at the end of Section 2. I was thinking along the lines below Bookmarks("\Section 2"). However it isn't working.Any thoughts ? thanks

Kaps
no_of_docs_to_add = UBound(third_Party_file_names_no_ext)

For j = 0 To no_of_docs_to_add

Set wrd_Next_Section = wrdApp.Documents.Open(third_Party_file_Names(j))


'identify the table
Set new_table = wrd_Next_Section.Tables(1)


Options.PasteFormatBetweenDocuments = 0
Options.PasteFormatBetweenStyledDocuments = 0

'copy over the document

new_table.Range.Copy

'paste the table

wrd_Main_Doc.Bookmarks("\Section 2").Range.PasteAndFormat (wdFormatOriginalFormatting)










Next j

Open in new window

Avatar of Helen Feddema
Helen Feddema
Flag of United States of America image

This recorded macro will do the job (I have a table saved as a Building Block -- for pre-Word 2007, it was AutoText).  It goes to Section 3, then back one space, then pastes the table from Building Blocks.  Tidy it up as needed for your situation.
If Section 2 is the last section, then go to the end of the document instead of to Section 3.
ASKER CERTIFIED SOLUTION
Avatar of GrahamSkan
GrahamSkan
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
It isn't clear from your code where the table to paste comes from -- if it has a standard format, it can be saved as AutoText or a Building Block