Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    May 2002
    Location
    Atlanta, Georgia, USA
    Posts
    124
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Can't find Word field in VBA (Word 2000)

    I'm trying to modify existing table formatting using a macro, and can't figure out how to change a field that's on one of the dialogs.

    In a table, right-click and select Table Properties, click the Cell tab, and then click Options. For Cell Margins, my existing tables have the "Same as the whole table" box unchecked. To match my other tables, I need to check that box using VBA. I can't find any property of Table or Cells that affects that box.

    I did find that I can set the padding values (BottomPadding, TopPadding) for a specific cell, but I don't think that changes the "match the table" option. Do I have to iterate through every cell in every table and set the appropriate padding?

    Can anyone help? Thanks!
    Bob
    Writing Consultant / Word Template Designer
    Words Connect

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Can't find Word field in VBA (Word 2000)

    Doesn't seem to be exposed in the object model - see this newsgroup thread.
    It may be possible to use SendKeys to set the option, but that is language-specific and I'm on a Dutch language PC at the moment.

  3. #3
    2 Star Lounger
    Join Date
    May 2002
    Location
    Atlanta, Georgia, USA
    Posts
    124
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Can't find Word field in VBA (Word 2000)

    Thanks for the link, Hans. Its unfortunate that option is not exposed. I wonder if that was a conscious decision, or just an oversight? I'd think that if it was an oversight, they would have fixed it by now....

    In that thread, someone pointed out that in Word 2002 and above, Dialogs(wdDialogTableCellOptions).Show will display the dialog in question. That did work for me in Word 2003, but for my situation, it is easier to iterate through the table cells and set the padding to match what is set for the table:
    <pre> For Each objCell In Selection.Cells
    objCell.BottomPadding = InchesToPoints(0)
    objCell.TopPadding = InchesToPoints(0)
    objCell.RightPadding = InchesToPoints(0.08)
    objCell.LeftPadding = InchesToPoints(0.08)
    Next </pre>


    The check box is still unchecked, but the end result is the same. This is preferable to me than having to sit and click the box for every table in each file.

    Bob
    Writing Consultant / Word Template Designer
    Words Connect

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •