![]() |
|
|
|
#1
|
|||
|
|||
|
Dear all,
I have inherited two macros that are used to generate a caption field at the top of a table in each document. It does this by inserting a row above the current row, however there is a caveat (explained after the code): Code:
Sub InsCptnRw() Selection.InsertRowsAbove 1 Selection.Cells.Merge With Selection.Cells With .Shading .Texture = wdTextureNone .ForegroundPatternColor = wdColorAutomatic .BackgroundPatternColor = wdColorAutomatic End With .Borders(wdBorderLeft).LineStyle = wdLineStyleNone .Borders(wdBorderRight).LineStyle = wdLineStyleNone .Borders(wdBorderTop).LineStyle = wdLineStyleNone With .Borders(wdBorderBottom) .LineStyle = wdLineStyleSingle .LineWidth = wdLineWidth025pt .Color = 7810048 End With .Borders(wdBorderDiagonalDown).LineStyle = wdLineStyleNone .Borders(wdBorderDiagonalUp).LineStyle = wdLineStyleNone .Borders.Shadow = False End With End Sub Code:
Sub HdrRw() With Selection.Cells With .Shading .Texture = wdTextureNone .BackgroundPatternColor = RGB(40, 70, 111) End With With .Borders(wdBorderLeft) .LineStyle = wdLineStyleSingle .LineWidth = wdLineWidth025pt .Color = 7810048 End With With .Borders(wdBorderRight) .LineStyle = wdLineStyleSingle .LineWidth = wdLineWidth025pt End With With .Borders(wdBorderTop) .LineStyle = wdLineStyleSingle .LineWidth = wdLineWidth025pt .Color = 7810048 End With With .Borders(wdBorderBottom) .LineStyle = wdLineStyleSingle .LineWidth = wdLineWidth025pt .Color = 7810048 End With With .Borders(wdBorderVertical) .LineStyle = wdLineStyleSingle '.LineWidth = wdLineWidth05pt .Color = RGB(255, 255, 255) End With .Borders(wdBorderDiagonalDown).LineStyle = wdLineStyleNone .Borders(wdBorderDiagonalUp).LineStyle = wdLineStyleNone .Borders.Shadow = False End With End Sub This is much appreciated and I hope it's clear. |
|
#2
|
|||
|
|||
|
It might be better to combine all this into one piece of code:
Create a table with: Top row set as caption row, second row set with shading and white text, third row set blank. |
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Field not showing in Pivot Table Field List | kmcovington | Excel | 0 | 10-26-2012 10:14 AM |
Combining Text from Table Cells
|
robmorleyuk | Word | 1 | 11-01-2011 07:24 AM |
How to make the Caption and its text have the same width as the table?
|
Jamal NUMAN | Word | 1 | 04-24-2011 06:44 PM |
Caption and Table of Figures issue
|
reece22345 | Word | 3 | 04-15-2011 12:18 AM |
| Spacing between table and caption | EtienneOBrien | Word Tables | 0 | 12-27-2008 01:58 AM |