Andreas Hermle
asked on
Apply a user-defined paragraph style to the first paragraph of Cell (1,1) of all the tables of the current document
Dear Experts:
below macro (Courtesy of MS Word 'Sage' Graham Skan) applies a user-defined paragraph style to the table cell that is located on the intersection of Row 4 and Column 2 (see line 10).
Could somebody please tweak this code due to a new requirement. The requirement is as follows:
Apply the heading Style "MyParaStyle" to the first paragraph of table cell (1,1), i.e. table cell (1,1) contains several paragraphs and only the first one should get the user-defined paragraph style applied.
Help is much appreciated. Thank you very much in advance.
Regards, Andreas
below macro (Courtesy of MS Word 'Sage' Graham Skan) applies a user-defined paragraph style to the table cell that is located on the intersection of Row 4 and Column 2 (see line 10).
Could somebody please tweak this code due to a new requirement. The requirement is as follows:
Apply the heading Style "MyParaStyle" to the first paragraph of table cell (1,1), i.e. table cell (1,1) contains several paragraphs and only the first one should get the user-defined paragraph style applied.
Help is much appreciated. Thank you very much in advance.
Regards, Andreas
Sub ApplyStyle()
Dim tbl As Table
If MsgBox("Would you like to apply the 'MyParaStyle' to the item name?" & vbCrLf & vbCrLf & _
"This will be the basis for the Adobe Acrobat bookmarks!", vbQuestion + vbYesNo, "Apply Style to Product Name") = vbNo Then
Exit Sub
End If
For Each tbl In ActiveDocument.Tables
tbl.Cell(4, 2).Range.Style = "MyParaStyle"
Next tbl
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Regards, Andreas