non breaking space Word 2003

A

Ann Marie

I have bookmark code to find non breaking space and convert. But how do I
set search string in Find - looking for serach string::

ASDN 12 123 123 123
19 July 2008 12 December 2007

So I can do find and replace all.

ActiveDocument.Bookmarks(1).Range.Find.Execute _

Findtext:=" ", _

ReplaceWith:="^s", _

Replace:=wdReplaceAll
 
D

Doug Robbins - Word MVP

Where do you want the non breaking space in place of each space in

ASDN 12 123 123 123
19 July 2008 12 December 2007

which is I assume what is contained in the first bookmark in the document or
just between the last 123 and the 19 of the July date?

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
G

Graham Mayor

Do I take it that you are trying to replace the spaces in the two strings
with non-breaking spaces (as indicated by your code snippet, but not your
question?)

Are these strings always together? Does the first part always have the same
number of letters digits and spaces? Are the two strings separated by a line
feed of a paragraph? You will need to provide more information, but to get
you started see http://www.gmayor.com/replace_using_wildcards.htm

Given that you have run two dates together I will assume that these strings
have nothing to do with one another. You can find dates with

([0-9]{1,2}) ([ADFJMNOS][a-z]{2,}) ([0-9]{4})
replace with
\1^0160\2^0160\3
(set wildcard switch)

The simple string is easier. If the strings are always the same length,
search for
([A-Z]{4}) ([0-9]{2}) ([0-9]{3}) ([0-9]{3}) ([0-9]{3})
replace with
\1^0160\2^0160\3^0160\4


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
A

Ann Marie

Yes Graham,

I have read it thanks (now you know how I get into these messes) - and am
not as proficient as yourself. I tossed the data to Word doc with replace
list array (so no formatting). I was hoping to put a routine at end of array
to search the document.

The string is "ASDN#xx#xxx#xxx#xxx" (where hash is soft space I want non
breaking space always without exception - the string is together.

The date is "10#m"onth year. So hash should be a ^s YES is it possible?

Thank you so much Graham and Doug for suggestions I shall try them.

I do have another problem while here - in 2007 Beta 2 VBA Find and Replace
does not show in my ADD-INS yet all my other add-ins do? Any ideas? The code
works fine? And in 2003 it is working fine.

Anyway back to my non breaking spaces.... and THANK YOU.

What's the expression - TOO MUCH KNOWLEDGE is a dangerous thing - I am
drowning in ideas....


Graham Mayor said:
Do I take it that you are trying to replace the spaces in the two strings
with non-breaking spaces (as indicated by your code snippet, but not your
question?)

Are these strings always together? Does the first part always have the
same number of letters digits and spaces? Are the two strings separated by
a line feed of a paragraph? You will need to provide more information, but
to get you started see http://www.gmayor.com/replace_using_wildcards.htm

Given that you have run two dates together I will assume that these
strings have nothing to do with one another. You can find dates with

([0-9]{1,2}) ([ADFJMNOS][a-z]{2,}) ([0-9]{4})
replace with
\1^0160\2^0160\3
(set wildcard switch)

The simple string is easier. If the strings are always the same length,
search for
([A-Z]{4}) ([0-9]{2}) ([0-9]{3}) ([0-9]{3}) ([0-9]{3})
replace with
\1^0160\2^0160\3^0160\4


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

Ann said:
I have bookmark code to find non breaking space and convert. But how
do I set search string in Find - looking for serach string::

ASDN 12 123 123 123
19 July 2008 12 December 2007

So I can do find and replace all.

ActiveDocument.Bookmarks(1).Range.Find.Execute _

Findtext:=" ", _

ReplaceWith:="^s", _

Replace:=wdReplaceAll
 
A

Ann Marie

Perfect - thank you Graham.

Graham Mayor said:
Do I take it that you are trying to replace the spaces in the two strings
with non-breaking spaces (as indicated by your code snippet, but not your
question?)

Are these strings always together? Does the first part always have the
same number of letters digits and spaces? Are the two strings separated by
a line feed of a paragraph? You will need to provide more information, but
to get you started see http://www.gmayor.com/replace_using_wildcards.htm

Given that you have run two dates together I will assume that these
strings have nothing to do with one another. You can find dates with

([0-9]{1,2}) ([ADFJMNOS][a-z]{2,}) ([0-9]{4})
replace with
\1^0160\2^0160\3
(set wildcard switch)

The simple string is easier. If the strings are always the same length,
search for
([A-Z]{4}) ([0-9]{2}) ([0-9]{3}) ([0-9]{3}) ([0-9]{3})
replace with
\1^0160\2^0160\3^0160\4


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

Ann said:
I have bookmark code to find non breaking space and convert. But how
do I set search string in Find - looking for serach string::

ASDN 12 123 123 123
19 July 2008 12 December 2007

So I can do find and replace all.

ActiveDocument.Bookmarks(1).Range.Find.Execute _

Findtext:=" ", _

ReplaceWith:="^s", _

Replace:=wdReplaceAll
 
A

Ann Marie

Graham - I have another question

10 May 2006

33 September 2007

4 June 2004

23 MAY 2006


I just replaced on above group as a test and the UPPERCASE (last) entry did
not alter? I did a wildcard search - MATCH CASE is not available? Can I fix
this or not?

([0-9]{1,2}) ([ADFJMNOS][a-z]{2,}) ([0-9]{4})
replace with
\1^0160\2^0160\3
(set wildcard switch)

Many thanks.
"Graham Mayor" <g

(e-mail address removed)> wrote in message
Do I take it that you are trying to replace the spaces in the two strings
with non-breaking spaces (as indicated by your code snippet, but not your
question?)

Are these strings always together? Does the first part always have the
same number of letters digits and spaces? Are the two strings separated by
a line feed of a paragraph? You will need to provide more information, but
to get you started see http://www.gmayor.com/replace_using_wildcards.htm

Given that you have run two dates together I will assume that these
strings have nothing to do with one another. You can find dates with

([0-9]{1,2}) ([ADFJMNOS][a-z]{2,}) ([0-9]{4})
replace with
\1^0160\2^0160\3
(set wildcard switch)

The simple string is easier. If the strings are always the same length,
search for
([A-Z]{4}) ([0-9]{2}) ([0-9]{3}) ([0-9]{3}) ([0-9]{3})
replace with
\1^0160\2^0160\3^0160\4


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

Ann said:
I have bookmark code to find non breaking space and convert. But how
do I set search string in Find - looking for serach string::

ASDN 12 123 123 123
19 July 2008 12 December 2007

So I can do find and replace all.

ActiveDocument.Bookmarks(1).Range.Find.Execute _

Findtext:=" ", _

ReplaceWith:="^s", _

Replace:=wdReplaceAll
 
D

Doug Robbins - Word MVP

Try:

([0-9]{1,2}) ([A-z]{3,}) ([0-9]{4})


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

Ann Marie said:
Graham - I have another question

10 May 2006

33 September 2007

4 June 2004

23 MAY 2006


I just replaced on above group as a test and the UPPERCASE (last) entry
did not alter? I did a wildcard search - MATCH CASE is not available? Can
I fix this or not?

([0-9]{1,2}) ([ADFJMNOS][a-z]{2,}) ([0-9]{4})
replace with
\1^0160\2^0160\3
(set wildcard switch)

Many thanks.
"Graham Mayor" <g

(e-mail address removed)> wrote in message
Do I take it that you are trying to replace the spaces in the two strings
with non-breaking spaces (as indicated by your code snippet, but not your
question?)

Are these strings always together? Does the first part always have the
same number of letters digits and spaces? Are the two strings separated
by a line feed of a paragraph? You will need to provide more information,
but to get you started see
http://www.gmayor.com/replace_using_wildcards.htm

Given that you have run two dates together I will assume that these
strings have nothing to do with one another. You can find dates with

([0-9]{1,2}) ([ADFJMNOS][a-z]{2,}) ([0-9]{4})
replace with
\1^0160\2^0160\3
(set wildcard switch)

The simple string is easier. If the strings are always the same length,
search for
([A-Z]{4}) ([0-9]{2}) ([0-9]{3}) ([0-9]{3}) ([0-9]{3})
replace with
\1^0160\2^0160\3^0160\4


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

Ann said:
I have bookmark code to find non breaking space and convert. But how
do I set search string in Find - looking for serach string::

ASDN 12 123 123 123
19 July 2008 12 December 2007

So I can do find and replace all.

ActiveDocument.Bookmarks(1).Range.Find.Execute _

Findtext:=" ", _

ReplaceWith:="^s", _

Replace:=wdReplaceAll
 
G

Graham Mayor

A minor change will fix that -

([0-9]{1,2}) ([ADFJMNOS][A-Za-z]{2,}) ([0-9]{4})
replace with
\1^0160\2^0160\3
(set wildcard switch)


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>


Ann said:
Graham - I have another question

10 May 2006

33 September 2007

4 June 2004

23 MAY 2006


I just replaced on above group as a test and the UPPERCASE (last)
entry did not alter? I did a wildcard search - MATCH CASE is not
available? Can I fix this or not?

([0-9]{1,2}) ([ADFJMNOS][a-z]{2,}) ([0-9]{4})
replace with
\1^0160\2^0160\3
(set wildcard switch)

Many thanks.
"Graham Mayor" <g

(e-mail address removed)> wrote in message
Do I take it that you are trying to replace the spaces in the two
strings with non-breaking spaces (as indicated by your code snippet,
but not your question?)

Are these strings always together? Does the first part always have
the same number of letters digits and spaces? Are the two strings
separated by a line feed of a paragraph? You will need to provide
more information, but to get you started see
http://www.gmayor.com/replace_using_wildcards.htm Given that you have run
two dates together I will assume that these
strings have nothing to do with one another. You can find dates with

([0-9]{1,2}) ([ADFJMNOS][a-z]{2,}) ([0-9]{4})
replace with
\1^0160\2^0160\3
(set wildcard switch)

The simple string is easier. If the strings are always the same
length, search for
([A-Z]{4}) ([0-9]{2}) ([0-9]{3}) ([0-9]{3}) ([0-9]{3})
replace with
\1^0160\2^0160\3^0160\4


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

Ann said:
I have bookmark code to find non breaking space and convert. But how
do I set search string in Find - looking for serach string::

ASDN 12 123 123 123
19 July 2008 12 December 2007

So I can do find and replace all.

ActiveDocument.Bookmarks(1).Range.Find.Execute _

Findtext:=" ", _

ReplaceWith:="^s", _

Replace:=wdReplaceAll
 
A

Ann Marie

Yes, THANK YOU just read that now last thing in my library on GOTCHAS"

THANK YOU so much for all the help guys. It works perfectly.


Graham Mayor said:
A minor change will fix that -

([0-9]{1,2}) ([ADFJMNOS][A-Za-z]{2,}) ([0-9]{4})
replace with
\1^0160\2^0160\3
(set wildcard switch)


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>


Ann said:
Graham - I have another question

10 May 2006

33 September 2007

4 June 2004

23 MAY 2006


I just replaced on above group as a test and the UPPERCASE (last)
entry did not alter? I did a wildcard search - MATCH CASE is not
available? Can I fix this or not?

([0-9]{1,2}) ([ADFJMNOS][a-z]{2,}) ([0-9]{4})
replace with
\1^0160\2^0160\3
(set wildcard switch)

Many thanks.
"Graham Mayor" <g

(e-mail address removed)> wrote in message
Do I take it that you are trying to replace the spaces in the two
strings with non-breaking spaces (as indicated by your code snippet,
but not your question?)

Are these strings always together? Does the first part always have
the same number of letters digits and spaces? Are the two strings
separated by a line feed of a paragraph? You will need to provide
more information, but to get you started see
http://www.gmayor.com/replace_using_wildcards.htm Given that you have
run two dates together I will assume that these
strings have nothing to do with one another. You can find dates with

([0-9]{1,2}) ([ADFJMNOS][a-z]{2,}) ([0-9]{4})
replace with
\1^0160\2^0160\3
(set wildcard switch)

The simple string is easier. If the strings are always the same
length, search for
([A-Z]{4}) ([0-9]{2}) ([0-9]{3}) ([0-9]{3}) ([0-9]{3})
replace with
\1^0160\2^0160\3^0160\4


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

Ann Marie wrote:
I have bookmark code to find non breaking space and convert. But how
do I set search string in Find - looking for serach string::

ASDN 12 123 123 123
19 July 2008 12 December 2007

So I can do find and replace all.

ActiveDocument.Bookmarks(1).Range.Find.Execute _

Findtext:=" ", _

ReplaceWith:="^s", _

Replace:=wdReplaceAll
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top