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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting TextColumns

Status
Not open for further replies.

DrkMAtter

MIS
Jun 6, 2003
5
CA
Greetings,
I must set a certain range to have 3 TextColumns. The problem is that the formatting is always applied to the whole document, which is of course not what I meant to do.

Here is the code I am using right now:


Dim c As Long
Dim x As Range


For c = 2 To InlineShapes.Count
Set x = ThisDocument.Range(InlineShapes(c).Range.End, InlineShapes(c + 1).Range.Start)

x.PageSetup.TextColumns.SetCount 3

Next c


Thanks for any help,
-Eric Fournier
 
Hi Eric,

Despite the fact that you explicitly apply the column formatting to your own range, Word applies it to the whole section it is in. To stop this you need to make sure it is in its own section by inserting section breaks before and after it before making it into columns.

Add the following code, or something similar, before you set your range variable:

Code:
ThisDocument.Range(Start:=InlineShapes(c).Range.End, _
                   End:=InlineShapes(c).Range.End). _
    InsertBreak Type:=wdSectionBreakContinuous

ThisDocument.Range(Start:=InlineShapes(c + 1).Range.Start, _
                   End:=InlineShapes(c + 1).Range.Start). _
    InsertBreak Type:=wdSectionBreakContinuous

Enjoy,
Tony
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top