Hi,

I've run into the following annoying, stupid issue:

Using VBA I want to do a search for 2 or more empty
paragraphs and replace them by one paragraph. Therefore I
use the following code:

With tDoc.Range.Find
.ClearFormatting
.Text = "^13{2,}" <----- problem
.Replacement.Text = "^p"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
.Execute Replace:=wdReplaceAll
End With

The line ".text = "^13{2,}"" is giving me problems
however. Because the comma is a list seperator, as defined
in my MS Windows regional settings dialog box (Start,
control panel, regional settings, numbers), it works fine
on my computer.
But a colleague has his list seperator set to ";". Thus,
Word pops up saying it is not a valid expression.
I want my program to work, regardless of the regional
settings. So i tried to find a variable or constant which
contains the list seperator character (be it ",", ";" or
whatever) and create the .text string accordingly; but I
didn't find any.

Any (other) solutions,
thanks
Ward

Re: regional settings' list seperator variable by Helmut

Helmut
Wed Dec 03 05:07:17 CST 2003

Hi Ward,
how about creating your own function "Separator"?
Function Separator() As String
Dim r As Range
Set r = ActiveDocument.Range
Separator = ","
With r.Find
.text = " {2,}"
.MatchWildcards = True
On Error GoTo step1
.Execute
End With
Exit Function
step1:
Separator = ";"
End Function
Besides that, there may be a variety of solutions.
Greetings from Bavaria, Germany
Helmut Weber
"red.sys" & chr$(64) & "t-online.de"
Word 97, NT 4.0


Re: regional settings' list seperator variable by Klaus

Klaus
Wed Dec 03 06:30:46 CST 2003

You can improve on that a bit by determining the list separator in VBA:

Separator = Application.International(wdListSeparator)

Then, you can build the expression using that separator:
.text = " {2" & Separator & "}"

Clumsy, but should work...

Klaus


"Helmut Weber" <elmkqznfwvccbf@mailinator.com> wrote:
> Hi Ward,
> how about creating your own function "Separator"?
> Function Separator() As String
> Dim r As Range
> Set r = ActiveDocument.Range
> Separator = ","
> With r.Find
> .text = " {2,}"
> .MatchWildcards = True
> On Error GoTo step1
> .Execute
> End With
> Exit Function
> step1:
> Separator = ";"
> End Function
> Besides that, there may be a variety of solutions.
> Greetings from Bavaria, Germany
> Helmut Weber
> "red.sys" & chr$(64) & "t-online.de"
> Word 97, NT 4.0
>



Re: regional settings' list seperator variable by ward

ward
Wed Dec 03 07:22:59 CST 2003


"Application.International(wdListSeparator)"

that's what i was looking for!!
thanks and regards,
Ward

>-----Original Message-----
>You can improve on that a bit by determining the list
separator in VBA:
>
>Separator = Application.International(wdListSeparator)
>
>Then, you can build the expression using that separator:
>..text = " {2" & Separator & "}"
>
>Clumsy, but should work...
>
>Klaus
>
>
>"Helmut Weber" <elmkqznfwvccbf@mailinator.com> wrote:
>> Hi Ward,
>> how about creating your own function "Separator"?
>> Function Separator() As String
>> Dim r As Range
>> Set r = ActiveDocument.Range
>> Separator = ","
>> With r.Find
>> .text = " {2,}"
>> .MatchWildcards = True
>> On Error GoTo step1
>> .Execute
>> End With
>> Exit Function
>> step1:
>> Separator = ";"
>> End Function
>> Besides that, there may be a variety of solutions.
>> Greetings from Bavaria, Germany
>> Helmut Weber
>> "red.sys" & chr$(64) & "t-online.de"
>> Word 97, NT 4.0
>>
>
>
>.
>