Thread: find/replace
View Single Post
  #7  
Old June 4th, 2010, 01:31 PM posted to microsoft.public.word.newusers
Stephen Larivee[_3_]
external usenet poster
 
Posts: 2
Default find/replace

Thank you!!

"Graham Mayor" wrote in message
...
The following macro will give you the value of a selected character

Sub ANSIValue()
S1$ = "Because the selected text contains"
S2$ = " characters, not all of the ANSI values will be displayed."
S3$ = "ANSI Value ("
S4$ = " characters in selection)"
S5$ = " character in selection)"
S6$ = "Text must be selected before this macro is run."
S7$ = "ANSI Value"
Dim strSel, strNums, LastFourChar As String
Dim iPos As Integer
strSel = Selection.Text
If Len(strSel) 0 Then
For i = 1 To Len(strSel)
strNums = strNums + Str(Asc(Mid(strSel, i)))
Next i
strNums = LTrim(strNums)
If Len(strNums) 255 Then
LastFourChar = Mid(strNums, 252, 4)
strNums = Left(strNums, 251) + Left(LastFourChar, 4 - InStr(" ",
LastFourChar))
MsgBox S1$ + Str(Len(strSel)) + S2$
End If
If Len(strSel) = 1 Then S4$ = S5$
MsgBox strNums, 0, S3$ + LTrim(Str(Len(strSel))) + S4$
Else
MsgBox S6$, 0, S7$
End If
End Sub

http://www.gmayor.com/installing_macro.htm

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



"Stephen Larivee" wrote in message
...
Thank you for your help and the file you worked on. The finished file is
just what I was trying to do. I think my only question would be, How did
you know that the separating mark was ASCII 29?


"Doug Robbins - Word MVP" wrote in message
...

The unknown character is a Group Separator (ASCII 29) and to deal with
it you must use

ActiveDocument.Range.Text = Replace(ActiveDocument.Range.Text, Chr(29),
Chr(9))

--
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, originally posted via msnews.microsoft.com

"Stephen Larivee" wrote in message
...
Win XP, Word 2003

I exported a field in FileMaker Pro. It is a repeating field with two
dates in one field. I thought I could import the field into Word and
find the marker that separates one date from the next and do a Replace
All and put a Tab between the two dates and then put the dates into two
different fields, the way they belong. I have the field in Word and
there is a small rectangle between the dates. So far nothing I have
used as a Find has "found" it, except for White Space (^w), but when I
do a find ^w and replace ^t, Word replaces thousands of the occurences
but the demon white rectanges remain. I even tried copying and pasting
the rectange into the Find box but that is not working.

I have a posting on a FileMaker Pro board to see if someone can show me
how to separate the dates from with FileMaker, but it seems I should be
able to do it from within Word.

Does anyone have a suggestion???