View Single Post
 
Old 07-18-2019, 05:25 PM
Guessed's Avatar
Guessed Guessed is offline Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,176
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

It appears you are going off down rabbit holes instead of addressing your actual requirement
Quote:
Originally Posted by sts023 View Post
I wish to insert three lines of text at the bottom of the first column on page 2, in a formatted box.
The following macro will move the contents of the current paragraph into a coloured box at the bottom of the first column on the current page. You could modify that to suit your specific requirements
Code:
Sub AddACallout()
  Dim aRange As Range, aShape As Shape, sCallout As String
  Dim bLeft As Boolean, i As Integer, sPath As String, iWidth As Integer
  
  iWidth = Selection.Sections(1).PageSetup.TextColumns(1).Width
    
  'Must be in Page Layout view for macro to show effect
  If ActiveWindow.View.SplitSpecial = wdPaneNone Then
    ActiveWindow.ActivePane.View.Type = wdPrintView
  Else
    ActiveWindow.View.Type = wdPrintView
  End If

  If Selection.Paragraphs.Count > 1 Then
    Set aRange = Selection.Range
    aRange.Start = aRange.Paragraphs.First.Range.Start
    aRange.End = aRange.Paragraphs.Last.Range.End
  Else
    Set aRange = Selection.Paragraphs(1).Range
  End If
  sCallout = aRange.Text
  aRange.Text = ""

  Set aShape = ActiveDocument.Shapes.AddShape(Type:=msoShapeRectangle, Left:=0, Top:=2, Width:=iWidth, Height:=80, Anchor:=aRange)  'msoShapeRoundedRectangle
  With aShape
    .TextFrame.TextRange = Left(sCallout, Len(sCallout) - 1)
    .TextFrame.TextRange.Style = "Normal"
    .TextFrame.MarginTop = 0
    .TextFrame.MarginLeft = 4
    .TextFrame.MarginRight = 4
    .TextFrame.MarginBottom = 4
    .TextFrame.AutoSize = True
    .WrapFormat.Type = wdWrapSquare
    .WrapFormat.Side = wdWrapBoth
    .RelativeVerticalPosition = wdRelativeVerticalPositionBottomMarginArea
    .Top = -.Height
    .RelativeHorizontalPosition = wdRelativeHorizontalPositionMargin
    .Left = wdShapeLeft
    .Line.Visible = msoFalse
    .Fill.ForeColor = RGB(150, 230, 230)
  End With
End Sub
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote