Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-15-2023, 12:11 AM
Dimsok Dimsok is offline Sort text alphabetical Windows XP Sort text alphabetical Office 2007
Advanced Beginner
Sort text alphabetical
 
Join Date: Sep 2014
Location: exUSSR
Posts: 50
Dimsok is on a distinguished road
Default Sort text alphabetical

May someone give an example of vba code to sort all lines alphabetical? MS Word 2007.
Reply With Quote
  #2  
Old 03-15-2023, 01:15 AM
gmayor's Avatar
gmayor gmayor is offline Sort text alphabetical Windows 10 Sort text alphabetical Office 2019
Expert
 
Join Date: Aug 2014
Posts: 4,103
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

'Lines' area vague concept n a Word document. If you mean paragraphs then
Code:
Selection.Sort _
            ExcludeHeader:=False, _
            FieldNumber:="Paragraphs", _
            SortFieldType:=wdSortFieldAlphanumeric, _
            SortOrder:=wdSortOrderAscending
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #3  
Old 03-20-2023, 12:33 AM
Dimsok Dimsok is offline Sort text alphabetical Windows XP Sort text alphabetical Office 2007
Advanced Beginner
Sort text alphabetical
 
Join Date: Sep 2014
Location: exUSSR
Posts: 50
Dimsok is on a distinguished road
Default

Thanks, but can you provide the whole code, which i can copy paste to ms word?
Reply With Quote
  #4  
Old 03-20-2023, 03:51 AM
gmayor's Avatar
gmayor gmayor is offline Sort text alphabetical Windows 10 Sort text alphabetical Office 2019
Expert
 
Join Date: Aug 2014
Posts: 4,103
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

Add
Code:
Sub Macroname()
at the start and
Code:
End Sub
at the end.
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #5  
Old 03-27-2023, 12:11 AM
Dimsok Dimsok is offline Sort text alphabetical Windows XP Sort text alphabetical Office 2007
Advanced Beginner
Sort text alphabetical
 
Join Date: Sep 2014
Location: exUSSR
Posts: 50
Dimsok is on a distinguished road
Default

Is it possible to sort paragraphs in random order?
Reply With Quote
  #6  
Old 03-27-2023, 04:59 PM
Guessed's Avatar
Guessed Guessed is offline Sort text alphabetical Windows 10 Sort text alphabetical Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,975
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

Not in Word without a macro.

If I was tasked with doing this I would paste the paragraphs into Excel, add a column beside with the formula =Rand(), sort on that column and then paste the result back into Word.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Sort text alphabetical Sorting does not produce an alphabetical list. alanterrill Word 7 11-22-2022 12:31 PM
WORD Text Sort Limitation Over65 Word 6 01-24-2022 05:08 PM
Sort text alphabetical What is the Word sort order for text? Jennifer Murphy Word 2 01-27-2017 07:18 PM
Sort text alphabetical Alphabetical Sort - result not alphabetical! hanvyj Excel 3 10-14-2013 10:59 PM
How to sort word text in alphabetic order . crossing Word 8 01-20-2012 09:51 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:46 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft