Log in

View Full Version : Combining lines and editing table row height



FFernandez
02-27-2013, 07:40 AM
Hello,

I don't have experience in dealing with VBA. Any help is appreciated. I have a document that is approximately 400 pages long which requires some editing. I need to combine lines together. For example,

I'd like to change:

Drawing: 123-45
Rev: B
Date: 3/4/09
or later revision

to:

Drawing: 123-45 Rev: B
Date: 3/4/09 or later revision

I have tons of rows in the Word document that require this formatting. Of course, the actual numbers and revision change.

Also, is there a way to control the height of rows through a macro? The data above is in tables. Again, any help is appreciated.

Doug Robbins
03-04-2013, 10:00 PM
If the four lines of data are in a single cell and are separated by paragraph returns, the following will do what you want:

Selection.HomeKey wdStory
Selection.Find.ClearFormatting
With Selection.Find
Do While .Execute(FindText:="^pRev:", Forward:=True, _
MatchWildcards:=False, Wrap:=wdFindContinue, MatchCase:=True) = True
Selection.Text = Replace(Selection.Text, vbCr, " ")
Loop
End With
Selection.HomeKey wdStory
Selection.Find.ClearFormatting
With Selection.Find
Do While .Execute(FindText:="^por later revision", Forward:=True, _
MatchWildcards:=False, Wrap:=wdFindContinue, MatchCase:=True) = True
Selection.Text = Replace(Selection.Text, vbCr, " ")
Loop
End With

If the layout is something else, tell us what it is.