Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Retrieve table style and paragraph styles of current table and display them in a MsgBox

Posted on 2014-12-22
3
Medium Priority
?
82 Views
Last Modified: 2014-12-22
Dear Experts:

For the currently selected table I would like to retrieve ...
... the table style (built on or custom table style) ...
... the paragraph style of the first cell in the first row and ...
... the paragraph style of the first cell in the second row ...

and display these styles in a MsgBox (using VBA), such as:
The currently selected table (5th table in the document) features the following styles:
Table Style: MyCustomTableStyleGrey
Paragraph Style of first cell in first row: Heading 1
Paragraph Style of first cell in second row: Normal

Help is very much appreciated. Thank you very much in advance.

Regards, Andreas
0
Comment
Question by:AndreasHermle
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 2000 total points
ID: 40513418
Hi Andreas, here's my effort
Sub ShowTableStyle()
    With Selection.Tables(1)
        MsgBox "Table Style: " & .Style & vbCrLf & _
               "Row1, Cell1 para style: " & .Cell(1, 1).Range.Paragraphs.First.Style & vbCrLf & _
               "Row2, Cell1 para style: " & .Cell(2, 1).Range.Paragraphs.First.Style
    End With
End Sub

Open in new window

0
 

Author Comment

by:AndreasHermle
ID: 40513650
Hi Graham,

long time no hear, but I was pretty sure that you would answer my question and as was the case 400 times before, you solved the question :-)
0
 

Author Closing Comment

by:AndreasHermle
ID: 40513654
Hi Graham,

thank you very much for your professional help. It works as desired. Great help.

have a nice christmas :-)
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you work with Word a lot, you probably use styles. If you use styles a lot, you've probably balled your fist more often than not when working with the ribbon. In Word 2007/2010, one of the things that I find missing when using styles is a quic…
A few years ago I was very much a beginner at VBA, and that very much remains the case today.  I'll do my best to explain things as I go in the hope that other beginners can follow.  If you just want to check out a tool that creates a Select Case fu…
This video shows where to find templates, what they are used for, and how to create and save a custom template using Microsoft Word.
This Micro Tutorial well show you how to find and replace special characters in Microsoft Word. This is similar to carriage returns to convert columns of values from Microsoft Excel into comma separated lists.

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question