+ Reply to Thread
Results 1 to 7 of 7

Macro To copy information in a table (keeping format and nested table intact)

  1. #1
    Valued Forum Contributor meabrams's Avatar
    Join Date
    10-03-2014
    Location
    USA
    MS-Off Ver
    2007, 2010, 2013, 2016
    Posts
    451

    Macro To copy information in a table (keeping format and nested table intact)

    I need a macro that will copy a cells contents that may include check boxes and nested tables, then paste it into current location of a different table.

    Currently the macro will replace everything on the document with a new table with only the copied information.

    Please Login or Register  to view this content.
    This code is not mine but I was hoping to use this to meet my needs... the original doc can be found at
    HTML Code: 
    Bramz

  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,726

    Re: Macro To copy information in a table (keeping format and nested table intact)

    Try something based on:
    Please Login or Register  to view this content.
    where, in Tables(1).Cell(2, 3): 1 is the index # of the source table in the document; 2 is the source row in that table; and 3 is the source column in that table.
    Cheers,
    Paul Edstein
    [Fmr MS MVP - Word]

  3. #3
    Valued Forum Contributor meabrams's Avatar
    Join Date
    10-03-2014
    Location
    USA
    MS-Off Ver
    2007, 2010, 2013, 2016
    Posts
    451

    Re: Macro To copy information in a table (keeping format and nested table intact)

    Doesn't seem to work how I need it to.... I think its having issues because I am trying to use the Macro Based Template as an add-in for another word doc... I have been able to get to copy the information just fine, now I need to be able to paste the data into the area that the cursor in on the open document that is using the add in.... For right now I can CTRL + V it in there, but I would like to make it more user friendly for everyone else that will be using this... I will work on creating sample to post here

  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,726

    Re: Macro To copy information in a table (keeping format and nested table intact)

    Quote Originally Posted by meabrams View Post
    I need to be able to paste the data into the area that the cursor in on the open document
    Pasting into an area under a cursor is entirely different from pasting it into the "current location" (post #1). For the latter, the selected insertion point is all that's needed; for the former, you'd need to invoke Windows APIs to determine the cursor location.

  5. #5
    Valued Forum Contributor meabrams's Avatar
    Join Date
    10-03-2014
    Location
    USA
    MS-Off Ver
    2007, 2010, 2013, 2016
    Posts
    451

    Re: Macro To copy information in a table (keeping format and nested table intact)

    I tried API's and did not find one that worked for me (I mostly made an error on how I tried to use it.) I did more digging/searching on the internet and found:

    Please Login or Register  to view this content.
    Then I used

    Please Login or Register  to view this content.
    and that seems to work ok for now...

    Thank you for your help in trying to point me in the right direction.

    I will post the sample version after I clean it up just in-case some wants to try to take this and make it into a fully working project. Now to start learn XML for custom Ribbons

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

    Re: Macro To copy information in a table (keeping format and nested table intact)

    Quote Originally Posted by meabrams View Post
    I tried API's and did not find one that worked for me (I mostly made an error on how I tried to use it.) I did more digging/searching on the internet and found:

    Please Login or Register  to view this content.
    Then I used

    Please Login or Register  to view this content.
    and that seems to work ok for now...
    That does nothing of substance different to what my code does, except that it transfers the data via the clipboard, thus wiping out anything that was already there...

  7. #7
    Valued Forum Contributor meabrams's Avatar
    Join Date
    10-03-2014
    Location
    USA
    MS-Off Ver
    2007, 2010, 2013, 2016
    Posts
    451

    Re: Macro To copy information in a table (keeping format and nested table intact)

    I will have to re-look at your code with fresh eyes tomorrow when I get a chance and try to adapt into this project. Thank you for your help!
    Attached Files Attached Files

+ 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. Replies: 4
    Last Post: 01-24-2017, 07:15 PM
  2. [SOLVED] Macro to extract information from exported file from one format table into another format
    By gmeikle in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-24-2017, 02:08 PM
  3. [SOLVED] Sort table while keeping multiple columns intact
    By Lucelline in forum Excel General
    Replies: 3
    Last Post: 05-03-2016, 03:49 AM
  4. Filtering Data: Keeping Rows of Information Intact
    By BCossette in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-09-2011, 12:58 AM
  5. Find Replace Macro keeping text format intact
    By data_encoder in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-10-2010, 10:55 PM
  6. Keeping Drop Down List intact while copy-pasting
    By singhabhijitkumar in forum Excel General
    Replies: 5
    Last Post: 02-08-2010, 07:25 AM
  7. [SOLVED] How to copy cells with keeping exact formula intact
    By Stephen in forum Excel General
    Replies: 6
    Last Post: 04-03-2005, 06:06 PM

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