View Single Post
 
Old 08-31-2021, 08:25 AM
ranjan ranjan is offline Windows 10 Office 2019
Advanced Beginner
 
Join Date: May 2021
Posts: 80
ranjan is on a distinguished road
Default

Hi,

I want to sort the fields from Descending to Ascending by a string length (Largest to smallest) before replacing on the target document, i had applied the below command but its not working can anyone review this...

Below highlighted is inserted in the above code if anything wrong please rectify..

.Text = Split(Tbl.Cell(r, 2).Range.Text, vbCr)(0)
.Replacement.Text = Split(Tbl.Cell(r, 3).Range.Text, vbCr)(0)
.SortOrder=wdSortOrderDescending
.Execute Replace:=wdReplaceAll

For Reference : 2 Smart Ways to Sort a Column of Texts by Length in Your Word - Data Recovery Blog

Last edited by ranjan; 08-31-2021 at 10:32 AM. Reason: Add: Sort by a length (large to small)
Reply With Quote