[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 544
  • Last Modified:

Word VBA textcolumns....

Hi,

Now I am able to add columns. But if I add textcolumns that is getting applied to the title also. And so the title is going to the first column. But my document format should be like this....

                                                  TITLE
                                                SUB TITLE

Feature One                                                                 Feature Three
    .Bullet One                                                                     .Bullet One
    .Bullet Two                                                                    .Bullet Two
    .Bullet Three                                                                  .Bullet Three

Feature Two                                                                Feature Four
    .Bullet One                                                                     .Bullet One
    .Bullet Two                                                                     .Bullet Two
    .Bullet Three                                                                  .Bullet Three


The column format should get apply only to the features and not to the title.
In a word document if I select only the features and say format>column it is spliting without affecting titles.
I am not able to do the same using VB code.
Hope I am clear.
0
amiteshsinha
Asked:
amiteshsinha
1 Solution
 
GrahamSkanCommented:
This will create two columns for all the document, except for the first two paragraphs.

Sub TwoColumnsBut2()
Dim rng As Range
Set rng = ActiveDocument.Range
rng.Collapse wdCollapseStart
rng.Expand wdParagraph
rng.Collapse wdCollapseEnd
rng.Expand wdParagraph
rng.Collapse wdCollapseEnd
rng.InsertBreak wdSectionBreakContinuous
    With ActiveDocument.Sections(2).PageSetup.TextColumns
        .SetCount NumColumns:=2
        .EvenlySpaced = True
        .LineBetween = False
        .Width = CentimetersToPoints(6.7)
        .Spacing = CentimetersToPoints(1.25)
    End With
End Sub
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now