Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.tables
kevin k via OfficeKB.com
 
Posts: n/a
Default Sorting numerals with decimals in Word

I have a table within a Word document that has been formatted and configured
the way management likes; i.e., it's aesthetically pleasing, easy to populate
and easy to distribute. However, I'm having an issue with the sorting of
section numbers containing decimals, namely, 1.2.2, 1.2.3...10.3.2, etc. etc.
This issue has come up several times and I understand reason behind it, as
described in threads like the following:

http://www.officekb.com/Uwe/Forum.aspx/ms-excel/60787

What I'd like to determine is if the coding solutions are available through
my existing Word document or is my only recourse to convert to Excel?

Thank you for your help-
Kevin

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...ables/200512/1
  #2   Report Post  
Posted to microsoft.public.word.tables
Helmut Weber
 
Posts: n/a
Default Sorting numerals with decimals in Word

Hi Kevin,

can all be done. No need of a quirk Excel formula.
Assuming, that you are at an intermediate VBA level,
here comes what you basically need for sorting,
a function to convert, e.g.
"10.3.2" to "010.003.002".
and a function for back conversion.

Public Function FillWith0(sTmp$) As String
Dim sArr() As String
sArr = Split(sTmp, ".")
For l = 0 To UBound(sArr)
sArr(l) = Format(sArr(l), "000")
Next
FillWith0 = Join(sArr, ".")
End Function
' ---
Public Function Remove0(sTmp$) As String
Dim sArr() As String
sArr = Split(sTmp, ".")
For l = 0 To UBound(sArr)
sArr(l) = Format(sArr(l), "0")
Next
Remove0 = Join(sArr, ".")
End Function
' ---
Sub convert()
MsgBox FillWith0("10.3.2")
MsgBox Remove0(FillWith0("10.3.2"))
End Sub

If you have no idea about programming,
then it'll be really tough.

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
apply a template to existing documents Bubba Gump Shrimp Page Layout 2 July 28th 05 04:46 PM
Does Word have Keyboard Merges like Word Perfect does? Donnas Mailmerge 1 June 28th 05 09:30 PM
Word2000 letterhead merge BAW Mailmerge 3 June 25th 05 01:17 PM
Underscore (_) will not always display in RTF files (Word 2002). David A Edge Microsoft Word Help 6 June 14th 05 10:39 AM
Macros - Keyboard Commands Janet Microsoft Word Help 6 April 11th 05 05:28 AM


All times are GMT +1. The time now is 04:34 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"