View Single Post
 
Old 02-06-2012, 05:57 AM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi tinfanide,

When developing automation code, it's often simpler to develop the target application's code in that application, then copy it to the automating application.

In Word, when you merge cells horizontally, only the left-most cell remains. Similarly, when you merge cells vertically, only the top-most cell remains. You can no longer address any of the other cells in the merged range. Try something based on the following Word macro:
Code:
Sub Demo()
Dim Rng As Word.Range, oDoc As Word.Document
Set oDoc = ActiveDocument
With oDoc.Tables(1)
  Set Rng = .Cell(4, 2).Range
  Rng.End = .Cell(6, 2).Range.End
  Rng.Cells.Merge
  Rng.Text = "Merged Column Cells"
End With
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote