Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cell merging in word using vba 1

Status
Not open for further replies.

LJtechnical

Technical User
Aug 7, 2002
90
GB
I am having trouble finding code to select two cells in order to merge them. I can write code which will preform the task in step mode but the code falls over when the whole script is run. I'm sure there is a couple of lines I can use to select two cells. Any help gratefully received.
 
you've probably already done this, but have you used the almighty macro recorder and then checked to see what it wrote? Seek not outside yourself; heaven is within.
 
Yes have tried numerous times using different methods. I think I have cracked it now just need to determine if there is a way to select a row and return how many cells the row contains.
 
Code:
Option Explicit

Sub test()
  If Selection.Information(wdWithInTable) Then
    MsgBox Selection.Rows(1).Cells.Count & " cells in 1st row of selection"
  Else
    MsgBox "not in table"
  End If
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top