Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

XL Numbering in Word AA, AB, AC, AD

0 views
Skip to first unread message

migpics

unread,
Jan 14, 2008, 12:10:06 PM1/14/08
to
Hi there.
I'm looking to set up XL numbering in Microsoft Word 2003.
I have been referenced to this site:
http://homepage.swissonline.ch/cindymeister/MiscFram.htm
and see an example about entering field codes. The problem is that it
doesn't help.

After I enter Ctrl+F9 to enter a field code bracket, I enter the information
in the quotes.
{ Quote { Set ABC { = { ABC } + 1 } }{ SET ABC2 { IF { ABC } > 26 "{ 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 }" } }

then I press Alt+F9 and everything goes away.
So after the Field Code disappears, how do I begin numbering my list?
Can anyone help with this? It's very frustrating when there isn't a
completed example with results either that, or I'm just not getting it.
Thanks
Miguel

Peter Jamieson

unread,
Jan 14, 2008, 3:58:19 PM1/14/08
to
Every single pair of {} has to be the special field code braces you can
enter using ctrl-F9, not just the outer braces.

Yes, it is a bit of a pain doing that - I've put a file with the fields in
temporarily at

http://tips.pjmsn.me.uk/quick/xlnumber.doc

Hope you'll be able to get it.

--
Peter Jamieson
http://tips.pjmsn.me.uk

"migpics" <mig...@discussions.microsoft.com> wrote in message
news:BD2020F5-2383-4037...@microsoft.com...

migpics

unread,
Jan 14, 2008, 4:55:00 PM1/14/08
to
Hi Peter.
Okay, I see how the field code works but where does one start entering the
text?

Does this code do the numbering automatically?
It generates an A, which is a good start but I don't end up with anything
except for A's.
Thanks for your help and patience.
Miguel

Stefan Blom

unread,
Jan 15, 2008, 5:44:11 AM1/15/08
to
You can use copy and paste to duplicate the fields. Note that you should
only copy the "big" field construct, not the initial SET fields of Peter's
code (where ABC, ABC1, and ABC2 are initialized to zero).

Be sure to update the fields in the correct order, one by one, with F9. At
least that is how I must do it, in order to get it to work in Word 2007.
(Considering how SET fields work, it actually makes some sense, but since
I've never tried this field construct before, I don't know if this is how it
used to work in older versions of Word.)

If you still run into trouble, note that the MOD command in the field code
must use the list separator character, as determined by your operating
system; for English language versions this usually means a comma.

--
Stefan Blom
Microsoft Word MVP


"migpics" wrote in message
news:0A349608-E907-4B18...@microsoft.com...

Peter Jamieson

unread,
Jan 15, 2008, 5:47:36 AM1/15/08
to
> Okay, I see how the field code works but where does one start entering the
> text?

What I suggest you do is add a tab, or full stop (period) then tab, or
whatever you would usually want after the "number", then copy/paste the
entire set of fields and that tab (apart from the { SET ABC 1 } stuff at the
beginning) so that each set of fields starts in a new paragraph. Let's say,
make 5 copies. Then select the lot and press F9. Press Alt-F9 if necessary
to see the results. You should see e.g.

A.
B.
C.
D.
E.
F.

Then add your text after the tab. To add another bullet, you have to insert
another copy of thhose fields, so it is advisable to keep them somewhere
useful, like an autotext or building block (Word 2007)

However, it is probably better to add anything you want after the "number"
inside the Quote field. That way, it's easier to be sure exactly where you
need to start typing your text and less easy to type text into the result of
the field, where it will be destroyed when you next update the field.

> Does this code do the numbering automatically?

Not in the sense that Word does numbering automatically. With numbering
created using your own field codes, you always have to update the field
codes by selecting them and re-executing them (typically using F9). But
that's /all/ you should have to do.

There are other approaches to this problem. For example, if you can download
the document temporarily at http://tips.pjmsn.me.uk/quick/xlnumb2.doc you
can see a method based on Word Document Variables. These are "invisible
values" created by VBA and stored within a Word document. They are a bit
like Document Properties except that there is no standard user interface
that lets the user set them up. Once you have created the document variables
you need, they are just there - you don't need any VBA in the document. You
can create another document with the same variables simply by copying the
document. You insert the values using { DOCVARIABLE } fields. So for example
if you create variables as follows

Name Value
SU1 A
SU2 B
.
.
SU26 Z
SU27 AA
SU28 AB
.
.
etc.

then you can insert your bullets using the following fields:

{ DOCVARIABLE "SU{ SEQ X }" }

If you want another list, you can use a different SEQ sequence name, e.g.

{ DOCVARIABLE "SU{ SEQ Y }" }

or you can reset the "X" sequence to 0 using e.g.

{ SEQ X \R0 }

VBA code (I've listed it in the document body) to (re-)create the necessary
document variables is as follows (this makes two versions - an uppercase
version with variable names SU1, SU2 etc. and a lowercase version with names
SL1, SL2 etc. Again, you can modify this to generate the exact bullet
content you want, e.g.

changing

strUValue = Chr(intLetter2 + 64)

to

strUValue = Chr(intLetter2 + 64) & "." & chr(9)

would add a full stop and tab after the "number".


'--------------------------------
Sub makesequencevariables()

Dim intLetter1 As Integer
Dim intLetter2 As Integer
Dim strUName As String
Dim strUValue As String
Dim strLName As String
Dim strLValue As String
Dim objVariable As Word.Variable

On Error Resume Next
For intLetter1 = 0 To 25
For intLetter2 = 1 To 26
strUValue = Chr(intLetter2 + 64)
strLValue = Chr(intLetter2 + 96)
If intLetter1 > 0 Then
strUValue = Chr(intLetter1 + 64) & strUValue
strLValue = Chr(intLetter1 + 96) & strLValue
End If
strUName = "SU" & Trim(CStr((26 * intLetter1) + intLetter2))
strLName = "SL" & Trim(CStr((26 * intLetter1) + intLetter2))
With ActiveDocument.Variables
.Item(strUName).Delete
.Add Name:=strUName, Value:=strUValue
.Item(strLName).Delete
.Add Name:=strLName, Value:=strLValue
End With
Next
Next

End Sub
'--------------------------------

The following macro removes /all/ the document variables in a document:

'--------------------------------
Sub removeallvariables()
Dim i As Integer
With ActiveDocument.Variables
For i = .Count To 1 Step -1
.Item(i).Delete
Next
End With
End Sub
'--------------------------------

It's also possible to do much the same thing, just using REF fields and
bookmarks.

--
Peter Jamieson
http://tips.pjmsn.me.uk

"migpics" <mig...@discussions.microsoft.com> wrote in message

news:0A349608-E907-4B18...@microsoft.com...

Peter Jamieson

unread,
Jan 15, 2008, 6:23:59 AM1/15/08
to
> (Considering how SET fields work, it actually makes some sense, but since
> I've never tried this field construct before, I don't know if this is how
> it used to work in older versions of Word.)

Yes, because SET sets the value of a bookmark the whole process relies on
that fact that when you update /all/ the bookmarks in a document, Word
updates them starting at the beginning. That may sound rather obvious but it
means for example that if you update the fields in /one/ bullet, Word will
start with the values of ABC, ABC1 and ABC2 at the time you do the update
(which are likely to be the values set in the last bullet in the document),
not the values in the previous bullet in the document. The same applies to
any numbering that is not generated completely automatically by Word.

--
Peter Jamieson
http://tips.pjmsn.me.uk

"Stefan Blom" <no....@please.xyz> wrote in message
news:u6L2OO2V...@TK2MSFTNGP06.phx.gbl...

Stefan Blom

unread,
Jan 15, 2008, 6:55:27 AM1/15/08
to
"Peter Jamieson" wrote in message
news:eshzhk2V...@TK2MSFTNGP05.phx.gbl...

>> (Considering how SET fields work, it actually makes some sense, but since
>> I've never tried this field construct before, I don't know if this is how
>> it used to work in older versions of Word.)
>
> Yes, because SET sets the value of a bookmark the whole process relies on
> that fact that when you update /all/ the bookmarks in a document, Word
> updates them starting at the beginning. That may sound rather obvious but
> it means for example that if you update the fields in /one/ bullet, Word
> will start with the values of ABC, ABC1 and ABC2 at the time you do the
> update (which are likely to be the values set in the last bullet in the
> document), not the values in the previous bullet in the document. The same
> applies to any numbering that is not generated completely automatically by
> Word.
>

Thanks for confirming this.

And to clarify what I wrote in my previous message: If I update the initial
SET fields first, then it works to select the QUOTE fields and update them
all at once.

migpics

unread,
Jan 15, 2008, 1:48:08 PM1/15/08
to
Well I see now how it works. My problem was two fold. I was initially
copying the {set ABC 1} lines, and two, I was not updating the fields.
This works great but my only problem is that it's not automated enough. But
hey, I can't complain. I am just amazed that Microsoft has not done this
yet. They're the ones who initially introduced the naming schem in XL so why
not do it in Word.
Thanks again!
Miguel

"Peter Jamieson" wrote:

> ..


> SU26 Z
> SU27 AA
> SU28 AB
> ..

> ..

0 new messages