Solved

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

Posted on 2014-12-22
3
76 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
  • 2
3 Comments
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 500 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

When creating Microsoft Word-based forms there may be a need to have a form field repeated throughout the whole document. For instance, with a company name, you may want this information repeated automatically throughout the document rather than man…
Preface: When I started this series, I used the term CommandBars because that is the Office Object class that it discusses. Unfortunately, when Microsoft introduced Office 2007, they replaced the standard Commandbar menus with "The Ribbon" and rem…
In this video, we show how to convert an image-only PDF file into a PDF Searchable Image file, that is, a file with both the image (typically from scanning) and text, which is created in an automated fashion with Optical Character Recognition (OCR) …
This video walks the viewer through the process of creating a watermark for their document, customizing it, and saving it for viewing/printing needs.

911 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now