Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 02-04-2021, 09:32 PM
macropod's Avatar
macropod macropod is offline To get Returned List Values of Objects Windows 10 To get Returned List Values of Objects Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,371
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by SamDsouza View Post
Just one observation:
When i implemented the code from the link on the document attached as per #1.

the nos of paragrapah were approximately 70.


But when the Table of Representation and para before the table quoted below

were completely removed then nos of paragraph were showing corrrectly.

If may i ask you why this happened ?
I have no idea what you mean.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #2  
Old 02-05-2021, 03:30 AM
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

Paul I implemented the same code after your reference link.

Would request you to check the Dcoument with code in that link.

after i implemented the coding from the link it showed 70 Paras.

But when the Table with rows and Columns were removed and para before the table removed it showed 13 paras in the attached document.

So i wanted to know why it displayed 70 nos of paras with the table

SamD
Reply With Quote
  #3  
Old 02-05-2021, 03:35 AM
macropod's Avatar
macropod macropod is offline To get Returned List Values of Objects Windows 10 To get Returned List Values of Objects Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,371
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by SamDsouza View Post
But when the Table with rows and Columns were removed and para before the table removed it showed 13 paras in the attached document.

So i wanted to know why it displayed 70 nos of paras with the table
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.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #4  
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
Reply

Thread Tools
Display Modes


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 08: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