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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|