Hi Guys
As this is my First post for VBA for word
Just wanted to have syntax for inserting blank line after a line/or paragraph typed
and also to insert a blank line before table is inserted and after line typed or paragraph
Code:
Private Sub InsertingBlankLine()
Dim objWord As Word.Application
Dim txtword As String, sh As Worksheet
Dim objDoc As Document
Dim objRange As Range
Dim objTable As Table
Dim intRows As Integer
Dim intCols As Integer
txtWord = "fsdhfkhfkdhfdskfhd fkdshfdkfhdskfhdsfd fdshgfdjdsjfg"
Set objWord = CreateObject("Word.Application")
Set objDoc = objWord.Documents.Add
objWord.Visible = True
objWord.ActiveDocument.Content.FormattedText.Text = txtWord
Set objRange = objDoc.Range
Set objRange = objDoc.Content
objRange.Collapse Direction:=wdCollapseEnd
'How to insert blank line here
intRows = 8: intCols = 5
objDoc.Tables.Add objRange, intRows, intCols
Set objTable = objDoc.Tables(1)
objTable.Borders.Enable = True
Set objWord = Nothing
End Sub
Thanks and regards
SamD