View Single Post
Old 09-02-2018, 02:52 PM
jeffreybrown jeffreybrown is offline Windows Vista Office 2007
Join Date: Apr 2016
Posts: 599
jeffreybrown will become famous soon enoughjeffreybrown will become famous soon enough

Here is what I tried after including the If test, but I get a "Compile Error: Method or data member not found"

It debugs to - .Text

I'm I right on thinking the [3-4] should be changed to [3] if I'm starting with Attachment 3 as the beginning point?

Sub Add_Rows_Table()
    Application.ScreenUpdating = False
    Dim Tbl As Table, Rng As Range
    For Each Tbl In ActiveDocument.Tables
        With Tbl
            If .Range.Characters.First.Previous.Paragraphs.Last.Text Like "Attachment [3]" & vbCr Then
                Set Rng = .Range
                .Range.Cells(.Range.Cells.Count).Range.InsertBreak Type:=wdColumnBreak
                .Range.Characters.First.Previous.InsertBefore vbCr
                .Range.Characters.First.Previous.Previous.FormattedText = Rng.Tables(2).Range.FormattedText
            End If
        End With
    Next Tbl
    Set Rng = Nothing
    Application.ScreenUpdating = True
End Sub
Reply With Quote