Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 12-07-2016, 02:09 PM
macropod's Avatar
macropod macropod is offline Two problems: Applying bold affects other tables and canvas doesn't appear at specified range Windows 7 64bit Two problems: Applying bold affects other tables and canvas doesn't appear at specified range Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,360
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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]
Reply With Quote
 



Similar Threads
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
Two problems: Applying bold affects other tables and canvas doesn't appear at specified range After applying a title style, the row in a table doesn't break 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
Two problems: Applying bold affects other tables and canvas doesn't appear at specified range Problems with linked tables becoming corrupt 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

Other Forums: Access Forums

All times are GMT -7. The time now is 03:13 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft