Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #7  
Old 02-05-2021, 08:11 PM
SamDsouza SamDsouza is offline To get Returned List Values of Objects Windows 10 To get Returned List Values of Objects Office 2013
Advanced Beginner
To get Returned List Values of Objects
 
Join Date: Aug 2019
Posts: 71
SamDsouza is on a distinguished road
Default

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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple found values from five sheets, multiple returned values in sheet six? irisha Excel Programming 26 09-30-2016 01:20 AM
To get Returned List Values of Objects Macros to move objects prevents moving same objects with arrow keys BruceM Word VBA 1 03-10-2015 08:20 AM
List of Objects for CreateObject excelledsoftware Excel Programming 4 09-14-2014 08:47 PM
To get Returned List Values of Objects Query list of objects and properties in VBA bshawnr Word VBA 1 08-22-2013 11:03 PM
Pivot Table:delete zero values when using calculated objects Serge 007 Excel 1 06-05-2013 11:47 AM

Other Forums: Access Forums

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