Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 08-03-2019, 02:21 AM
SamDsouza SamDsouza is offline syntax for inserting blank line before inserting table and after a line or paragraph Windows 10 syntax for inserting blank line before inserting table and after a line or paragraph Office 2013
Advanced Beginner
syntax for inserting blank line before inserting table and after a line or paragraph
 
Join Date: Aug 2019
Posts: 71
SamDsouza is on a distinguished road
Default syntax for inserting blank line before inserting table and after a line or paragraph

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
Reply With Quote
 

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
syntax for inserting blank line before inserting table and after a line or paragraph Sparse words in line when inserting a link titanic Word 4 11-12-2018 01:50 PM
syntax for inserting blank line before inserting table and after a line or paragraph Inserting code line in Word Module mihnea96 Excel Programming 2 08-15-2017 04:57 AM
syntax for inserting blank line before inserting table and after a line or paragraph Word inserting line breaks / wrapping text Girloutside Word 1 08-10-2015 12:45 PM
syntax for inserting blank line before inserting table and after a line or paragraph inserting wordwrap table causes paragraph break in text sodiumkpump Word Tables 1 08-05-2015 06:36 PM
syntax for inserting blank line before inserting table and after a line or paragraph Inserting key strokes with a macro line ACA Word VBA 4 12-03-2012 04:40 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:35 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