+ Reply to Thread
Results 1 to 3 of 3

Formatting a Word table with Excel VBA

  1. #1
    Forum Contributor
    Join Date
    04-20-2017
    Location
    Iowa
    MS-Off Ver
    2007
    Posts
    212

    Formatting a Word table with Excel VBA

    Hello all,
    I've spent a great deal of time in the Excel VBA forum, but I think this is more specific to members watching this one.

    So far I've got the sub-routine to open a word template and paste the excel data in a table. What I cannot figure out is how to then format the table from within the excel VB editor, primarily the column widths.

    When fully operational, the word document will only be created and saved without the user actually viewing it. This part is also working quite well.

    The code given here is the section where the actual pasting operation runs. Hopefully this will provide enough information to let someone get me on the right path. I can upload the workbook but all of the file paths and document names would have to be changed in order for someone to test it. Thought I would try this approach first.

    Thanks to any and all for suggestions.

    Please Login or Register  to view this content.

  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: Formatting a Word table with Excel VBA

    Since you're using a template, I can't see why you'd want any of the code that does the basic page setup & formatting; that should all be predefined in the template itself, obviating the need for any code to do that. Similarly, with your table - predefined column widths and cell formatting should already exist in the template. Then all you need is:
    Please Login or Register  to view this content.
    Cheers,
    Paul Edstein
    [Fmr MS MVP - Word]

  3. #3
    Forum Contributor
    Join Date
    04-20-2017
    Location
    Iowa
    MS-Off Ver
    2007
    Posts
    212

    Re: Formatting a Word table with Excel VBA

    Thank you for the suggestions and cleaner code.

    I need to go back to the template and keep working on the formatting. This is my first go around with getting Excel and Word to work together, a lot to learn yet, obviously.

    Thanks again!

+ 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: 2
    Last Post: 10-30-2014, 01:49 AM
  2. Formatting Word table cells
    By tania19b in forum Word Formatting & General
    Replies: 1
    Last Post: 01-13-2013, 07:16 PM
  3. Word Table Formatting problem
    By pangs76 in forum Word Programming / VBA / Macros
    Replies: 6
    Last Post: 12-21-2012, 08:55 AM
  4. Replies: 2
    Last Post: 12-12-2012, 09:58 AM
  5. Posting table to word from excel 2007 & retain formatting - pasteobject?
    By wonderdunder in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-27-2011, 06:46 AM
  6. Excel to Word table (and formatting)
    By dems in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-05-2009, 09:06 PM
  7. Table formatting for pasting in Word?
    By astro_al in forum Excel General
    Replies: 0
    Last Post: 02-07-2005, 10:03 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