Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 08-06-2019, 02:58 AM
SamDsouza SamDsouza is offline Inserting New Table at Different Position Appropirate Spacing required between Line and Paragraphs Windows 10 Inserting New Table at Different Position Appropirate Spacing required between Line and Paragraphs Office 2013
Advanced Beginner
Inserting New Table at Different Position Appropirate Spacing required between Line and Paragraphs
 
Join Date: Aug 2019
Posts: 71
SamDsouza is on a distinguished road
Default

Having tried the below code


Private Sub InsertingBlankLine()
Dim oWord As Object
Dim oDoc As Object
Dim oCell As Object, txtWord as String

txtword = "To," & vbCrLf & "Add1," & vbCrLf & "Add2" & vbCrLf & "Add3" & vbCrLf & _
"Date : " & TextBox1.Text & vbCrLf & vbCrLf & " " & TextBox2.Text & vbCrLf & _
"Sub : " & vbCrLf & vbCrLf & "Dear Sir/Madam" & vbCrLf & _
" " & TextBox3.Text & " With a request to fdljfljdljf kdfhdfhdhfdfhd" & vbCrLf & _
"sjfhksdfhdskfhdsfkds / XXX. hbxczkdhsakdhsdjshkdjsh."

On Error Resume Next
Set oWord = GetObject(, "Word.Application")
If Err Then
Set oWord = CreateObject("Word.Application")
End If
On Error GoTo 0
Set oDoc = oWord.Documents.Add
oWord.Visible = True
With oDoc
'.Content = "kdhfdskfhd fkdshfdkfhdskfhdsfd fdshgfdjdsjfg" & vbCr & vbCr & "Paragraph / Line after table"
.Content = txtWord
'''''''''' The Content Breaks or txtWord breaks and Table is inserted as it breaks and inserts the table and it reads the first 1 sentence of txtWord and not the full content or TxtWord
how can i close or collapse the content here to get full content or full txtword then add the table with continuing below code


.Tables.Add .Paragraphs(2).Range, 8, 5
With .Tables(1)
.Borders.Enable = True
Set oCell = .Cell(1, 1).Range
oCell.End = oCell.End - 1
oCell.Text = "row 1"
oCell.Bold = True
Set oCell = .Cell(2, 1).Range
oCell.End = oCell.End - 1
oCell.Text = "row 2"
Set oCell = .Cell(3, 1).Range
oCell.End = oCell.End - 1
oCell.Text = "row 3"
Set oCell = .Cell(4, 1).Range
oCell.End = oCell.End - 1
oCell.Text = "row 4"
Set oCell = .Cell(5, 1).Range
oCell.End = oCell.End - 1
oCell.Text = "row 5"
Set oCell = .Cell(6, 1).Range
oCell.End = oCell.End - 1
oCell.Text = "row 6"
Set oCell = .Cell(7, 1).Range
oCell.End = oCell.End - 1
oCell.Text = "row 7"
Set oCell = .Cell(8, 1).Range
oCell.End = oCell.End - 1


oCell.Text = "row 8"
.Range.Font.Name = "Tahoma"
.Range.Font.Size = 15
End With
End With
Add another txtWord or new Paragraph after the table. Collapse or end it then
Add another table at different position in the same line after New txtWord or new paragraph as show in doc file


Set oWord = Nothing
Set oDoc = Nothing
Set oCell = Nothing
End Sub

Your help will be highly appreciated
SamD
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
syntax for inserting blank line before inserting table and after a line or paragraph SamDsouza Word VBA 8 08-04-2019 11:10 PM
Line spacing in table differs when one column is bulleted PDSF Word 2 10-23-2017 01:16 PM
Spacing After Paragraphs chcalissie Word 6 10-17-2017 05:48 AM
Inserting New Table at Different Position Appropirate Spacing required between Line and Paragraphs Help required with spacing rohanmalhotra Word VBA 3 08-11-2011 04:06 AM
Inserting New Table at Different Position Appropirate Spacing required between Line and Paragraphs character spacing position disabled fogharty Word 2 07-27-2011 01:26 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:27 AM.


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