K
Keith G Hicks
I'm trying to figure out the code for a rectangular block. I have some text
that comes out of an old DOS program. It's mostly text but there are a few
odd characters. I've handled most of them but one is a vertical rectangluar
block. This old DOS program exports the block into a text file as a Ý (Y
with an accent mark above it). I have a macro (vba code) that is converting
the Y into a pipe symbol but I'd rather convert it into the block that it's
supposed to be. If I open the DOS program, copy the text to the clipboard
and paste it directly into Word it does show the block. If I ALT+X the block
the code is 258C. But that doesn't work in my vba code.
Here's my code now:
Selection.HomeKey Unit:=wdStory
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "Ý"
.Replacement.Text = "|"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
How do I change the line .Replacement.Text = "|" so that I get the 258C
block. I tried figuring out the Chr() for it but had no success. I was going
to do this:
..Replacement.Text = Chr(<some decimal code>)
but I couldn't figure out the decimal code for it.
If you go here: http://en.wikipedia.org/wiki/Code_page_437, it says that
258C is 221 but Chr(221) didn't give me the rectangular block.
It just stays as a Ý
What am I doing wrong?
Keith
that comes out of an old DOS program. It's mostly text but there are a few
odd characters. I've handled most of them but one is a vertical rectangluar
block. This old DOS program exports the block into a text file as a Ý (Y
with an accent mark above it). I have a macro (vba code) that is converting
the Y into a pipe symbol but I'd rather convert it into the block that it's
supposed to be. If I open the DOS program, copy the text to the clipboard
and paste it directly into Word it does show the block. If I ALT+X the block
the code is 258C. But that doesn't work in my vba code.
Here's my code now:
Selection.HomeKey Unit:=wdStory
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "Ý"
.Replacement.Text = "|"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
How do I change the line .Replacement.Text = "|" so that I get the 258C
block. I tried figuring out the Chr() for it but had no success. I was going
to do this:
..Replacement.Text = Chr(<some decimal code>)
but I couldn't figure out the decimal code for it.
If you go here: http://en.wikipedia.org/wiki/Code_page_437, it says that
258C is 221 but Chr(221) didn't give me the rectangular block.
It just stays as a Ý
What am I doing wrong?
Keith