Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 02-06-2012, 04:16 AM
tinfanide tinfanide is offline Set range for merged Word table cells? Windows 7 64bit Set range for merged Word table cells? Office 2010 32bit
Expert
Set range for merged Word table cells?
 
Join Date: Aug 2011
Posts: 312
tinfanide is on a distinguished road
Default Set range for merged Word table cells?

Code:
Dim oWord As Word.Application
Set oWord = New Word.Application
Dim oDoc As Word.Document
Set oDoc = oWord.Documents.Add
oWord.Visible = True
oDoc.Activate


With oWord


Dim Table1 As Word.Table
Set Table1 = oDoc.Tables.Add(Range:=oDoc.ActiveWindow.Selection.Range, _
NumRows:=6, _
NumColumns:=3, _
DefaultTableBehavior:=wdWord8TableBehavior)

    With Table1

    .Rows.WrapAroundText = True

        .Borders(wdBorderTop).LineStyle = wdLineStyleSingle
        .Borders(wdBorderRight).LineStyle = wdLineStyleSingle
        .Borders(wdBorderBottom).LineStyle = wdLineStyleSingle
        .Borders(wdBorderLeft).LineStyle = wdLineStyleSingle
        .Borders(wdBorderHorizontal).LineStyle = wdLineStyleSingle
        .Borders(wdBorderVertical).LineStyle = wdLineStyleSingle


.Rows(1).Cells.Merge
.Rows(2).Cells.Merge
.Rows(3).Cells.Merge

.Cell(4, 2).Select
With oDoc.ActiveWindow.Selection
.MoveDown Unit:=wdLine, Count:=2, Extend:=wdExtend
.Cells.Merge

''' Here, how can I reference to this merged cells?
''' I mean 
''' Dim rng As Range
'''  Set rng = ???

.Text = "Merged Column Cells"

End With


    End With

End With
Please see the comments.
I have tried
Code:
Dim rng As Range
Set rng = ActiveDocument.Range(Start:=ActiveDocument.Tables(1).Cell(4,2).Range.Start,End:=ActiveDocument.Tables(1).Cell(6,2).Range.End)
But error...
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 02:16 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