split table and insert text

User avatar
stuck
Panoramic Lounger
Posts: 8225
Joined: 25 Jan 2010, 09:09
Location: retirement

split table and insert text

Post by stuck »

I've split a table and inserted some text underneath it:

Code: Select all

Selection.Tables(1).Rows(4 + intSplitRange + 1).Select
    Selection.splitTable
    ftrText = "my table footer text goes here"
    Selection.InsertAfter (ftrText)
where intSplitRange is a number of rows determined earlier in the code.

What I want to do next is move down into the new other half of the table and past in some header rows (already copied in to a range) but I can't figure out how to get into that (new) table :hairout:

Any suggestions gratefully received.

Ken

User avatar
HansV
Administrator
Posts: 78789
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: split table and insert text

Post by HansV »

Selection.MoveDown will place the insertion point in the first cell of the "lower half".
Best wishes,
Hans

User avatar
stuck
Panoramic Lounger
Posts: 8225
Joined: 25 Jan 2010, 09:09
Location: retirement

Re: split table and insert text

Post by stuck »

Thanks, that was too obvious.

However, even though I can see that the cursor has moved into the new table when I paste the header rows that I mentioned had been copied earlier, they are not being inserted at that point, they are being dumped into the original top half. Any idea why that is?

Ken

User avatar
HansV
Administrator
Posts: 78789
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: split table and insert text

Post by HansV »

I'll have to check, but I'll be busy with other things for an hour or so.
Best wishes,
Hans

User avatar
stuck
Panoramic Lounger
Posts: 8225
Joined: 25 Jan 2010, 09:09
Location: retirement

Re: split table and insert text

Post by stuck »

Umm, thanks but no need. Bad case of :stupidme:

Ken

User avatar
Rudi
gamma jay
Posts: 25455
Joined: 17 Mar 2010, 17:33
Location: Cape Town

Re: split table and insert text

Post by Rudi »

Are you needing to move down into the table and paste the table headings again?

How about this?

Code: Select all

    Selection.MoveDown
    Selection.SelectRow
    Selection.PasteAndFormat (wdFormatPlainText)
Regards,
Rudi

If your absence does not affect them, your presence didn't matter.

User avatar
stuck
Panoramic Lounger
Posts: 8225
Joined: 25 Jan 2010, 09:09
Location: retirement

Re: split table and insert text

Post by stuck »

Thanks Rudi but there was no problem, apart from me getting the syntax of my paste was wrong. It was pasting in the top half because that's where I was telling it to paste :blush:

Ken

User avatar
HansV
Administrator
Posts: 78789
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: split table and insert text

Post by HansV »

Stupid computers - always doing what you tell them to do, instead of what you want them to do... :cranky:
Best wishes,
Hans