#1
|
|||
|
|||
Paste merge into word table
I'd like to know the VBA to paste merge.
also asked here in more detail: http://www.accessforums.net/showthread.php?t=72952 I'd just like to know if its possible before looking at workarounds. |
#2
|
||||
|
||||
For that you might use code like:
Code:
ActiveDocument.Tables(1).Range.Characters.Last.Next.PasteAppendTable
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
Hi Paul, Sorry for the delay.
this is the closest thing I have seen to something that works. Quote:
it seems about 50/50 if it actually pastes in the bookmark. But its not always predictable sometimes you get two good ones in a row sometimes two bad ones. I have similar code importing data from access which works without issue on the same document. Maybe its an issue with doing this with a table of data rather than one field. If you have any ideas I would love to hear them, Thanks a lot, Andy. |
#4
|
||||
|
||||
The code I posted has nothing to do with bookmarks - which your initial post here and at accessforums made no mention of. As coded, the macro simply pastes your added content to the end of the first table in the active document. Obviously, you'd need to change the table reference or edit the code so it refers to the bookmarked table.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
|||
|
|||
I know it doesn't, I've added it to the code I was using.
Quote:
As I've been using bookmarks with no issue I didn't think it would be an issue. I thought I just needed to know the paste command which I couldn't find. (I was looking for merge not append) |
#6
|
||||
|
||||
Try:
Code:
objWord.ActiveDocument.Bookmarks("RISKS").Tables(1).Range.Characters.Last.Next.PasteAppendTable
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#7
|
|||
|
|||
Brilliant. I was getting
Quote:
I don't know if I should be naming tables or even if its possible but its working perfect now. Really appreciate your help, it will save hours of time. |
#8
|
||||
|
||||
If, by naming, you mean bookmarking, that's certainly possible and sometimes desirable. The whole table needn't be bookmarked, either; even a bookmarked single character (e.g. an end-of-cell marker) in it would suffice.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Looking to copy select cells in table using dropdown list to paste to new table in another worksheet | CaptainRetired | Excel Programming | 18 | 01-04-2018 07:22 PM |
Paste Table From XL - Word Error - Bad Parameter | dan88 | Word VBA | 3 | 06-16-2016 05:39 AM |
How can I paste text that's not formatted as a table into a new table? | WaltR | Word | 2 | 10-11-2014 03:16 PM |
How to paste the data from one table into the cells of another table, without overwriting anything | CClio333 | Word Tables | 1 | 08-12-2014 05:17 PM |
Is it possible to copy non-contiguous rows of a Table and paste them as a separate Table in Word? | Joey Cheung | Word Tables | 1 | 08-12-2014 05:15 PM |