From: andreas on 9 Mar 2010 10:47 Dear Experts: I got a document with a lot of tables where I applied user-defined table styles (name convention: all beginning with "tbl_style_ ") to about 50% of the tables: Is it possible thru a macro to retrieve the table style for each table: Example: Table 3: tbl_style_blue Table 4: tbl_style_blue Table 5: tbl_style_red Table 7: tbl_style_grey Table 1, 2, 6: no user-defined table style applied Help is much appreciated. Thank you very much in advance. Regards, Andreas
From: Fumei2 via OfficeKB.com on 9 Mar 2010 12:42 Sub EachTableStyle() Dim oTable As Table For Each oTable In ActiveDocument.Tables MsgBox oTable.Range.Style Next End Sub If a table uses a table style, you get the name. If it does not, you get "Table Grid". andreas wrote: >Dear Experts: > >I got a document with a lot of tables where I applied user-defined >table styles (name convention: all beginning with "tbl_style_ ") to >about 50% of the tables: > >Is it possible thru a macro to retrieve the table style for each >table: Example: > >Table 3: tbl_style_blue >Table 4: tbl_style_blue >Table 5: tbl_style_red >Table 7: tbl_style_grey >Table 1, 2, 6: no user-defined table style applied > >Help is much appreciated. Thank you very much in advance. > >Regards, Andreas -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.aspx/word-programming/201003/1
From: Stefan Blom on 9 Mar 2010 13:23 Actually, "Table Grid" is also a style; it's one of the built-in table styles. -- Stefan Blom Microsoft Word MVP "Fumei2 via OfficeKB.com" <u53619(a)uwe> wrote in message news:a4c2a0dc21031(a)uwe... > Sub EachTableStyle() > Dim oTable As Table > For Each oTable In ActiveDocument.Tables > MsgBox oTable.Range.Style > Next > End Sub > > If a table uses a table style, you get the name. If it does not, you get > "Table Grid". > > andreas wrote: >>Dear Experts: >> >>I got a document with a lot of tables where I applied user-defined >>table styles (name convention: all beginning with "tbl_style_ ") to >>about 50% of the tables: >> >>Is it possible thru a macro to retrieve the table style for each >>table: Example: >> >>Table 3: tbl_style_blue >>Table 4: tbl_style_blue >>Table 5: tbl_style_red >>Table 7: tbl_style_grey >>Table 1, 2, 6: no user-defined table style applied >> >>Help is much appreciated. Thank you very much in advance. >> >>Regards, Andreas > > -- > Message posted via OfficeKB.com > http://www.officekb.com/Uwe/Forums.aspx/word-programming/201003/1 >
From: andreas on 11 Mar 2010 18:18 On Mar 9, 6:42 pm, "Fumei2 via OfficeKB.com" <u53619(a)uwe> wrote: > Sub EachTableStyle() > Dim oTable As Table > For Each oTable In ActiveDocument.Tables > MsgBox oTable.Range.Style > Next > End Sub > > If a table uses a table style, you get the name. If it does not, you get > "Table Grid". > > > > > > andreas wrote: > >Dear Experts: > > >I got a document with a lot of tables where I applied user-defined > >table styles (name convention: all beginning with "tbl_style_ ") to > >about 50% of the tables: > > >Is it possible thru a macro to retrieve the table style for each > >table: Example: > > >Table 3: tbl_style_blue > >Table 4: tbl_style_blue > >Table 5: tbl_style_red > >Table 7: tbl_style_grey > >Table 1, 2, 6: no user-defined table style applied > > >Help is much appreciated. Thank you very much in advance. > > >Regards, Andreas > > -- > Message posted via OfficeKB.comhttp://www.officekb.com/Uwe/Forums.aspx/word-programming/201003/1- Hide quoted text - > > - Show quoted text - Hi Fumei, exactly what I was after. Thank you very much for your terrific help. Regards, Andreas
From: andreas on 11 Mar 2010 18:19 On Mar 9, 7:23 pm, "Stefan Blom" <StefanB...(a)discussions.microsoft.com> wrote: > Actually, "Table Grid" is also a style; it's one of the built-in table > styles. > > -- > Stefan Blom > Microsoft Word MVP > > "Fumei2 via OfficeKB.com" <u53619(a)uwe> wrote in messagenews:a4c2a0dc21031(a)uwe... > > > > > Sub EachTableStyle() > > Dim oTable As Table > > For Each oTable In ActiveDocument.Tables > > MsgBox oTable.Range.Style > > Next > > End Sub > > > If a table uses a table style, you get the name. If it does not, you get > > "Table Grid". > > > andreas wrote: > >>Dear Experts: > > >>I got a document with a lot of tables where I applied user-defined > >>table styles (name convention: all beginning with "tbl_style_ ") to > >>about 50% of the tables: > > >>Is it possible thru a macro to retrieve the table style for each > >>table: Example: > > >>Table 3: tbl_style_blue > >>Table 4: tbl_style_blue > >>Table 5: tbl_style_red > >>Table 7: tbl_style_grey > >>Table 1, 2, 6: no user-defined table style applied > > >>Help is much appreciated. Thank you very much in advance. > > >>Regards, Andreas > > > -- > > Message posted via OfficeKB.com > >http://www.officekb.com/Uwe/Forums.aspx/word-programming/201003/1- Hide quoted text - > > - Show quoted text - Hey Stefan, thank you for your professional support. Regards, Andreas
|
Pages: 1 Prev: Random AutoText entries Next: macro to run automatically when a field is updated |