Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #5  
Old 09-02-2018, 02:52 PM
jeffreybrown jeffreybrown is offline Merge the first row in a table Windows Vista Merge the first row in a table Office 2007
Expert
Merge the first row in a table
 
Join Date: Apr 2016
Posts: 673
jeffreybrown has a spectacular aura aboutjeffreybrown has a spectacular aura about
Default

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?

Code:
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
                .Rows.Add
                Set Rng = .Range
                .Range.Cells(.Range.Cells.Count).Range.InsertBreak Type:=wdColumnBreak
                Rng.Tables(2).Range.Cells.Merge
                .Range.Characters.First.Previous.InsertBefore vbCr
                .Range.Characters.First.Previous.Previous.FormattedText = Rng.Tables(2).Range.FormattedText
                Rng.Tables(2).Delete
                .Range.Characters.First.Previous.Delete
                .Range.Characters.Last.Next.Delete
            End If
        End With
    Next Tbl
    Set Rng = Nothing
    Application.ScreenUpdating = True
End Sub
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Merge the first row in a table How do I mail merge records into table columns with more than one merge field? tech123 Mail Merge 1 04-26-2017 07:13 PM
Merge the first row in a table Table Merge murazlan Mail Merge 3 11-21-2016 08:05 PM
Merge the first row in a table Merge only the text in a table and keep the 2 original colums of a table james1979uk Word Tables 5 12-15-2013 05:48 PM
Cannot Merge Into A Table MacDee Mail Merge 1 01-29-2013 07:21 PM
Merge the first row in a table Merge Two Table in VBA donbexcel Word VBA 2 10-21-2011 11:46 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:15 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