Re: Outline numbering sequence (A...Z, AA, AB, AC, ...)

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Greg (gmaxey_at_mvps.org)
Date: 01/18/05


Date: 18 Jan 2005 11:20:12 -0800

G.G. Yagoda,

Far from genious, the following field code does a fair job of
sequencing from a through ab through zz:

{QUOTE {SET ABC {IF {ABC} = "Error! Bookmark not defined.""1"{=
ABC + 1}}{SET ABC2 {IF {= MOD({ABC}, 26)} = 1 {= ABC2 +
1}{ABC2}{ABC2}}}{SET ABC1 { IF ABC1 < 26 { =ABC1 +1}"1"}}{IF {ABC}
< 27 "{ABC1 \* alphabetic}""{ABC2 \* alphabetic}{ABC1 \*
alphabetic}"}

The negative part is the process for updating after any additions or
deletions in the sequence. Because of the bookmarks, a b c will become
d e f if the fields are updated before the bookmarks are deleted.

Understanding the limited applications for this sequence, a determined
user could use this macro to update:

Sub UpdateSEQNumbers()

With ActiveDocument.Bookmarks
On Error Resume Next
.Item("ABC").Delete
.Item("ABC1").Delete
.Item("ABC2").Delete
End With
ActiveDocument.Fields.Update

End Sub



Relevant Pages