Solved

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

Posted on 2014-12-22
3
77 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Microsoft Word Mass E-Mail Message 10 95
Spacing of words on a Word Document. 18 46
MS Word Office 365 Mail Merge 2 61
Office 365 home questions 7 65
The Selection object is designed for user interaction. It has a Range property, so it can be used in most places that a Range object can. Recorded macros must use the Selection because they are simply copying what the user is doing. A Range prope…
Nice table. Huge mess. Maybe this was something you created way back before you figured out tabs or a document you received from someone else. Either way, using the spacebar to separate the columns resulted in a mess. Trying to convert text to t…
This video walks the viewer through the process of creating a watermark for their document, customizing it, and saving it for viewing/printing needs.
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …

777 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