A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Word » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

How to make table of contents for different regional settings?



 
 
Thread Tools Display Modes
  #1  
Old December 2nd, 2008, 01:37 PM posted to microsoft.public.word.docmanagement
claesafk
external usenet poster
 
Posts: 2
Default How to make table of contents for different regional settings?

I am trying to design a Word template to be used in the company I work for.
Most of the computers are set up to be used in Sweden. This means, for
example, that the comma is used for decimal separator and the semi-colon is
used as a list separator. Most of our writing is made in English. Some
engineers have set the regional settings to use "." as a decimal separator
and the "," as a list separator. This is a problem when, for example,
creating a Word template with table of contents.

Is there a way to write a macro that reads the list separator from from the
regional settings and creates an appropriate TOC field code?
  #2  
Old December 2nd, 2008, 06:34 PM posted to microsoft.public.word.docmanagement
Peter Jamieson
external usenet poster
 
Posts: 4,550
Default How to make table of contents for different regional settings?

Is the problem mainly with the list separator in e.g.

{ TOC \t "style1,1,style2,2" \h \z \u }

? If so, something that may work as long as you know all the possible list
separators that your documents' users /might/ use is to use something like
the following immediately before the TOC field:

{ IF { =product(2;3) } = 6 "{ SET list ";" }" "" }{ IF { =product(2,3) } = 6
"{ SET list "," }" "" }

then use

{ TOC \t "style1{ list }1{ list }style2{ list }2" \h \z \u }

where all the {} have to be the special field code braces you can insert
using ctrl-F9

I wouldn't put this into any mailmerge main documents as it will cause
errors to pop up when you merge.



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

"claesafk" wrote in message
...
I am trying to design a Word template to be used in the company I work for.
Most of the computers are set up to be used in Sweden. This means, for
example, that the comma is used for decimal separator and the semi-colon
is
used as a list separator. Most of our writing is made in English. Some
engineers have set the regional settings to use "." as a decimal separator
and the "," as a list separator. This is a problem when, for example,
creating a Word template with table of contents.

Is there a way to write a macro that reads the list separator from from
the
regional settings and creates an appropriate TOC field code?


  #3  
Old December 3rd, 2008, 09:47 AM posted to microsoft.public.word.docmanagement
claesafk
external usenet poster
 
Posts: 2
Default How to make table of contents for different regional settings?

Peter,
Thank you for the tip! It works. This was exactly what I wanted to do. I am
now trying to figure out were to put the code to make sure that it is
"executed" before the TOC is updated and that it is not removed by the user
(as it is invisible). Is there a way to force "update fields" when
opening/closing/printing the document? Personally, I usually click on the TOC
and press F9 to update the table. If I do that without updating the field you
suggested first, I will get an error.

Best regards,
Claes af Klinteberg

"Peter Jamieson" wrote:

Is the problem mainly with the list separator in e.g.

{ TOC \t "style1,1,style2,2" \h \z \u }

? If so, something that may work as long as you know all the possible list
separators that your documents' users /might/ use is to use something like
the following immediately before the TOC field:

{ IF { =product(2;3) } = 6 "{ SET list ";" }" "" }{ IF { =product(2,3) } = 6
"{ SET list "," }" "" }

then use

{ TOC \t "style1{ list }1{ list }style2{ list }2" \h \z \u }

where all the {} have to be the special field code braces you can insert
using ctrl-F9

I wouldn't put this into any mailmerge main documents as it will cause
errors to pop up when you merge.



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

"claesafk" wrote in message
...
I am trying to design a Word template to be used in the company I work for.
Most of the computers are set up to be used in Sweden. This means, for
example, that the comma is used for decimal separator and the semi-colon
is
used as a list separator. Most of our writing is made in English. Some
engineers have set the regional settings to use "." as a decimal separator
and the "," as a list separator. This is a problem when, for example,
creating a Word template with table of contents.

Is there a way to write a macro that reads the list separator from from
the
regional settings and creates an appropriate TOC field code?



  #4  
Old December 3rd, 2008, 08:05 PM posted to microsoft.public.word.docmanagement
Peter Jamieson
external usenet poster
 
Posts: 4,550
Default How to make table of contents for different regional settings?

I am
now trying to figure out were to put the code to make sure that it is
"executed" before the TOC is updated


It's always difficult to /ensure that such stuff is updated but nesting all
the fields inside a { QUOTE } field may slightly reduce the possibility that
someone will update the TOC without the other stuff.

e.g. { QUOTE { IF { =product(2;3) } = 6 "{ SET list ";" }" "" }{ IF {
=product(2,3) } = 6 "{ SET list "," }" "" }{ TOC \t "style1,1,style2,2" \h
\z \u } }

Is there a way to force "update fields" when
opening/closing/printing the document?


Only really by using an Auto macro such as AutoOpen (e.g. if you know the
QUOTE field is the first field,

Sub AutoOpen()
ActiveDocument.Content.Fields(1).Select
Selection.Fields.Update
End Sub

may be enough)

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

"claesafk" wrote in message
...
Peter,
Thank you for the tip! It works. This was exactly what I wanted to do. I
am
now trying to figure out were to put the code to make sure that it is
"executed" before the TOC is updated and that it is not removed by the
user
(as it is invisible). Is there a way to force "update fields" when
opening/closing/printing the document? Personally, I usually click on the
TOC
and press F9 to update the table. If I do that without updating the field
you
suggested first, I will get an error.

Best regards,
Claes af Klinteberg

"Peter Jamieson" wrote:

Is the problem mainly with the list separator in e.g.

{ TOC \t "style1,1,style2,2" \h \z \u }

? If so, something that may work as long as you know all the possible
list
separators that your documents' users /might/ use is to use something
like
the following immediately before the TOC field:

{ IF { =product(2;3) } = 6 "{ SET list ";" }" "" }{ IF { =product(2,3) }
= 6
"{ SET list "," }" "" }

then use

{ TOC \t "style1{ list }1{ list }style2{ list }2" \h \z \u }

where all the {} have to be the special field code braces you can insert
using ctrl-F9

I wouldn't put this into any mailmerge main documents as it will cause
errors to pop up when you merge.



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

"claesafk" wrote in message
...
I am trying to design a Word template to be used in the company I work
for.
Most of the computers are set up to be used in Sweden. This means, for
example, that the comma is used for decimal separator and the
semi-colon
is
used as a list separator. Most of our writing is made in English. Some
engineers have set the regional settings to use "." as a decimal
separator
and the "," as a list separator. This is a problem when, for example,
creating a Word template with table of contents.

Is there a way to write a macro that reads the list separator from from
the
regional settings and creates an appropriate TOC field code?




 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 06:31 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.