![]() |
|
|
Thread Tools | Display Modes |
#2
|
||||
|
||||
![]()
The change vis-à-vis the bold effect is probably because you've defined the 'Table Text' Style with the 'automatically update' attribute.
I'm not seeing the errant canvas behaviour, but that may be due to not having the same page layout & content you're starting with. The following works for me: Code:
Sub sbInsertScientificResultsDiscussion() Application.ScreenUpdating = False With ActiveDocument With .Range .InsertAfter vbCr & "Results and Discussion" & vbCr .Paragraphs.Last.Previous.Style = "Heading 1" .Tables.Add Range:=.Characters.Last, numrows:=5, numcolumns:=3, _ DefaultTableBehavior:=wdWord9TableBehavior With .Tables(.Tables.Count) .Range.InsertCaption Label:="Table", Position:=wdCaptionPositionAbove, _ Title:=":" & vbTab & "Add table caption text" & vbCr .AllowAutoFit = False .BottomPadding = 3 .TopPadding = 3 .LeftPadding = 6 .RightPadding = 6 .PreferredWidth = CentimetersToPoints(15.5) With .Range .Style = "Table Text" .Cells.VerticalAlignment = wdCellAlignVerticalCenter .Cells(1).Range.Text = "Table Text + local effect: bold" .Cells(1).Range.Font.Bold = True .Cells(4).Range.Text = "Table text + local effect: Align left" .Cells(4).Range.ParagraphFormat.Alignment = wdAlignParagraphLeft .Cells(5).Range.Text = "Table Text is centered by default" End With End With .Paragraphs.Last.Style = "Notes" .InsertAfter Text:="a." & vbTab & "This is a footnote a. to the table" & vbCr .InsertAfter Text:="b." & vbTab & "This is a footnote b. to the table" & vbCr .Paragraphs.Last.Style = "Body Text" End With .Shapes.AddCanvas Left:=0, Top:=0, Anchor:=.Range.Characters.Last, _ Width:=CentimetersToPoints(15.5), Height:=CentimetersToPoints(7.06) .Shapes(.Shapes.Count).WrapFormat.Type = wdWrapInline End With Application.ScreenUpdating = True End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
When changing table style in Word 2010, font size seems to change but doesn't show in new tables | heartsoulliving | Word | 1 | 12-07-2016 05:17 PM |
![]() |
Salix | Word | 6 | 05-05-2016 12:48 PM |
Alignment problems with decimals using tables in Publisher 2013 | Beautiful Artist | Publisher | 0 | 02-24-2015 07:18 PM |
![]() |
word_madness | Word | 2 | 02-10-2015 04:00 AM |
Tables from Excel to Word: Problems | Guillo | Word | 0 | 11-19-2014 01:42 AM |