vb.net word document column break

  • Thread starter Thread starter Preeti
  • Start date Start date
P

Preeti

How can i insert coloumn break and switch between two columns in word
document through VB.net?
 
Hello, Preeti,

Here is an example that sets the number of columns to 2 and puts the text
from Textbox1 into the first column and the text from Textbox2 into the
second column.

Dim oWord As Word.Application
Dim wDoc As Word.Document
Dim para1 As Word.Paragraph

oWord = DirectCast(CreateObject("Word.Application"), Word.Application)
oWord.Visible = True

wDoc = oWord.Documents.Add

With wDoc.PageSetup.TextColumns
.SetCount(NumColumns:=2)
End With

para1 = wDoc.Content.Paragraphs.Add
para1.Range.InsertBreak(Type:=Word.WdBreakType.wdColumnBreak)
para1.Range.InsertBefore(Me.TextBox1.Text)
para1.Range.InsertAfter(Me.TextBox2.Text)

Cheers,
Randy
 
Back
Top