+ Reply to Thread
Results 1 to 2 of 2

Excel VBA to make/format Word Table

  1. #1
    Registered User
    Join Date
    03-10-2014
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    70

    Excel VBA to make/format Word Table

    Hello everyone, I can't for the life of me figure out the proper syntax for editing the format of a Word table using an excel VBA macro.

    I currently have a working macro that creates a table in word and properly populates the correct values, with borders, and shading. But I don't know how to change the spacing so that the text in each cell of the table is vertically centered. I tried using the 'record macro' in word and using that formatting code in the excel macro, but it says something doesn't exist.

    This is my current formatting in excel for the word table. It's excel and Word 2007. What also works is changing the line spacing 'before' to 3 pt.

    oTable.Rows(1).Range.Font.Bold = True
    oTable.Rows(1).Range.Font.Italic = True
    oTable.Rows(1).Range.Shading.BackgroundPatternColor = -603923969
    oTable.Cell(1, 1).Range.Text = "Existing Fund"
    oTable.Cell(1, 2).Range.Text = "Replacement Fund"
    oTable.Borders.Enable = True

    Thanks in advance

  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: Excel VBA to make/format Word Table

    Try:
    Please Login or Register  to view this content.
    Note: If the row height isn't set and/or the paragraph format has different before/after spacing, the effect of the vertical centring may not be apparent.
    Cheers,
    Paul Edstein
    [Fmr MS MVP - Word]

+ 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: 3
    Last Post: 01-28-2012, 09:55 AM
  2. [SOLVED] Make Excel Table fit into Word Doucument
    By R in forum Excel - New Users/Basics
    Replies: 4
    Last Post: 02-13-2006, 12:00 AM
  3. [SOLVED] How do you make it so you can see Your table in word?
    By XxCarolexX in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-09-2006, 01:30 AM
  4. [SOLVED] HOW TO MAKE A EXCEL & WORD FILE IN RECOGNIZABLE FORMAT
    By SHAHZAIB ISMAIL in forum Excel General
    Replies: 3
    Last Post: 11-18-2005, 01:45 PM
  5. transferring word doc to excel including table format
    By hokieguy in forum Excel General
    Replies: 2
    Last Post: 06-10-2005, 07:05 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