![]() |
#2
|
||||
|
||||
![]()
Your code could be greatly simplified. For example, to produce an alpha-sorted Custom Document Property list:
Code:
Sub Sort_Custom_Document_Properties() Dim DocProp As DocumentProperty, CustPropArr() As String ReDim Preserve CustPropArr(0): CustPropArr(0) = "" ' Add Custom Document Properties to Array For Each DocProp In ActiveDocument.CustomDocumentProperties With DocProp If InStr(1, .Name, "contenttype", vbTextCompare) = 0 Then ReDim Preserve CustPropArr(UBound(CustPropArr) + 1) CustPropArr(UBound(CustPropArr)) = .Name & "|" & .Type & "|" & .Value End If End With Next DocProp WordBasic.SortArray CustPropArr MsgBox Join(CustPropArr, vbCr) End Sub I'm not convinced there's much to be gained by reinserting them in the sorted order, though.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
Thread Tools | |
Display Modes | |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
andiekit | Word | 13 | 03-18-2021 07:02 AM |
![]() |
NicoleJones | Word VBA | 3 | 03-10-2021 08:43 PM |
![]() |
kschmidt | Word VBA | 7 | 02-04-2019 03:09 PM |
![]() |
thedr9wningman | Word VBA | 3 | 01-20-2014 05:56 PM |
![]() |
NicBodkin | Word | 8 | 05-05-2011 09:09 AM |