Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 02-06-2012, 05:57 AM
macropod's Avatar
macropod macropod is offline Set range for merged Word table cells? Windows 7 64bit Set range for merged Word table cells? Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,384
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
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Set range for merged Word table cells? Word VBA: add textboxs in table cells? tinfanide Word VBA 12 02-09-2012 12:05 AM
Set range for merged Word table cells? Sum Formula in the range with Numeric and NonNumeric data cells Spanec Excel 2 01-12-2012 09:15 AM
Count range cells eliminating merge cells danbenedek Excel 0 06-15-2010 12:40 AM
Set range for merged Word table cells? Cut and paste a range of cells and preserve formatting StarWeaver Excel 1 03-02-2010 01:41 PM
How do I reference a merged cell in a multi column & row table in MS Word ('03')? jihanemo Word Tables 0 03-18-2009 08:33 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:48 PM.


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