Quote:
Simple: Your table has multiple cells (or one cell with 70 paragraphs), and each cell has one or more paragraphs. For example, suppose you have a 5*14 table. Even the empty cells have a single paragraph so far as Word is concerned. So, even if there were no paragraph breaks in the table, there would be an output for 70 paragraphs in the macro.
|
Ok Now i understand
As i began to code for what i desire Can you help me with equal nos of spacing
between Style , Alignment and Font Name
below is the representation in Textbox1
Quote:
Para No Style Alignment Font Name
001 Normal (Web) 0 Arial
002 Normal (Web) 0 Arial
003 Normal (Web) 0 Times New Roman
004 Normal (Web) 0 Arial
005 Normal (Web) 0 Arial
006 Normal (Web) 0 Arial
007 Normal (Web) 0 Arial
008 Normal (Web) 0 Arial
009 Normal (Web) 0 Arial
010 Normal (Web) 0 Arial
011 Normal (Web) 0 Arial
012 Normal (Web) 0 Arial
013 Normal 0 Arial
|
If you observe the above the last Para No 013 Style "Normal" Alignment 0 and font name Arial have shifted to left as there is no equal spacing.
How can i have equal spacing between Two Strings and later Equal spacing between Font name other Returned value of object and so on.
Any kind of function to insert in code to achieve Equal spacing between the Returned value of objects leading to Neat representation
I tried below with gapbetween as integer ,LEN ..... but somehow no success then used vbTab but still no success
Code:
'Module1
Option Explicit
Public Const minStrLen As Integer = 24
'Userform1
Private Sub ListBasicReturnedObjects()
Dim StrData As String, StrSty As String, Sty As Style, strstylen As Integer
Dim gapBetween As Integer
Dim i As Long, j As Long, k As Long, bTabOK As Boolean, Rng As Range
Dim bldFont As Boolean, strHeader As String, Pos As Integer, newPos As Integer
Dim StrRecord As String
strHeader = "Para No" & Space(5) & "Style" & Space(15) & "Alignment" & Space(2) & "Font Name"
StrData = strHeader & vbCrLf
With ActiveDocument.Range
For i = 1 To .Paragraphs.Count
With .Paragraphs(i)
StrSty = .Style
StrData = StrData & vbCr & Format(i, "#00#") & Space(8) & Mid(StrSty, 1, Len(StrSty))
strstylen = Len(Mid(StrSty, 1, Len(StrSty)))
gapBetween = minStrLen - strstylen
Set Sty = ActiveDocument.Styles(StrSty)
If Sty.ParagraphFormat.Alignment <> .Alignment Then
Else
If gapBetween <= 15 Then
StrData = StrData & vbTab & .Alignment & vbTab & .Range.Font.Name
Else
StrData = StrData & vbTab & .Alignment & vbTab & .Range.Font.Name
End If
End If
End With
Next
TextBox1.Text = TextBox1.Text & StrData
End With
End Sub
SamD