Solved

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

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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Introduction Authors who set out to write any sort of lengthy piece for online submission—be it a long question or comment on a technical form, an article, or a substantial blog entry—often find it useful to work up a draft in an editor other t…
This is written from a 'VBA for MS Word' perspective, but I am sure it applies to most other MS Office components where VBA is used.  One thing that really bugs me is slow code, ESPECIALLY when it's mine!  In programming there are so many ways to…
This video teaches the viewer how to align pictures around text while keeping the text properly aligned in the document.
Office 365 is currently available in five editions. Three of them are for business use: Office 365 Business Essentials, Office 365 Business, and Office 365 Business Premium. Two of them are for home/personal use: Office 365 Home and Office 365 Perso…

708 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

12 Experts available now in Live!

Get 1:1 Help Now