Results 1 to 2 of 2
  1. #1
    Star Lounger
    Join Date
    Jan 2003
    San Francisco, California, USA
    Thanked 0 Times in 0 Posts

    Table Styles - Word 2007

    Hi All, does anyone know of a good source for learning and programming table styles? I could not find anything in this lounge or word processing. Has anyone had a bad experience with table styles? What is interesting is when you record a macro to create a table style and set certain properties, this code does not work when the macro is ran from vb. For example this code produces an error (see bold). What is further perplexing is that after a table style is created and you try to edit it, the style turns into a character style. This is why the bolded line below does not work because a character style does not have a border property?

    With ActiveDocument.Styles("PCYC-Table").Table.Condition(wdFirstRow)
    .Borders(wdBorderLeft).LineStyle = wdLineStyleNone
    .Borders(wdBorderRight).LineStyle = wdLineStyleNone
    .Borders(wdBorderTop).LineStyle = wdLineStyleSingle
    .Borders(wdBorderBottom).LineStyle = wdLineStyleSingle
    .Borders(wdBorderVertical).LineStyle = wdLineStyleNone
    .Borders.Shadow = False
    End With

  2. #2
    Super Moderator
    Join Date
    Jan 2001
    Melbourne, Victoria, Australia
    Thanked 295 Times in 267 Posts
    What code have you used to create the table style? I have not had the problem of them converting themselves to Character styles.

    I would have thought that the problem with the line is that the constant wdLineStyleNone doesn't exist in VB (but does in Word VBA). Try replacing it with 0 and use 1 in place of the wdLineStyleSingle constant
    Andrew Lockton, Chrysalis Design, Melbourne Australia

Tags for this Thread

Posting Permissions

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