Question about a WORD document, VB and CHR(13) 
Author Message
 Question about a WORD document, VB and CHR(13)

Hello,
I have a little app that merges data into a word document.  Now when I do a
find and replace when there is a chr(13) in the string it breaks it up and
puts the text after the chr(13) on the next line... However, If I replace
text that is in a table with data that has the chr(13) in it I get the
printed character and its not putting the text on the next line.  Anyone
know why?  and how to get it to put the text after the chr(13) on another
line instead of giving me the non printable character?  Thanks


Mon, 15 Aug 2005 02:57:20 GMT  
 Question about a WORD document, VB and CHR(13)
use the constant vb new line instead of chr$(13)

a new line is a chr$(13) & chr$(10)

D.

Quote:

> Hello,
> I have a little app that merges data into a word document.  Now when I do a
> find and replace when there is a chr(13) in the string it breaks it up and
> puts the text after the chr(13) on the next line... However, If I replace
> text that is in a table with data that has the chr(13) in it I get the
> printed character and its not putting the text on the next line.  Anyone
> know why?  and how to get it to put the text after the chr(13) on another
> line instead of giving me the non printable character?  Thanks



Mon, 15 Aug 2005 03:22:37 GMT  
 Question about a WORD document, VB and CHR(13)

Quote:
> use the constant vb new line instead of chr$(13)

> a new line is a chr$(13) & chr$(10)

Sometimes a new line is just written as vbCr (Chr$(10)) such as when the
file is coming from a non-Windows OS, so it's best to simply replace all
instances of Chr$(10) and Chr($13) individually rather than assuming they'll
appear together, that way you're sure of getting rid of them either way.

'***
NewText = Replace$(Replace$(OldText, vbCr, ""), vbLf, "")
'***

Hope this helps,

    Mike

 -- EDais --

 - Microsoft Visual Basic MVP -
WWW: Http://EDais.earlsoft.co.uk/




Mon, 15 Aug 2005 03:52:08 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. chr(10) and chr(13) in memofield gives |

2. Chr(10) & Chr(13)

3. Chr(10) and Chr(13) doesn't work

4. is carriage return chr(13) or chr(32)

5. INPUT OR READ TO STRIP CHR(10) AND CHR(13)

6. What is chr$(13) + chr$(10)

7. vbCRLF = chr(13) + chr(10)

8. Enter Parameter value CHR(13)

9. Appending chr(13) to a memo field?

10. what's the difference...(chr(13)) and vbCr

11. appending Chr(13) to memo fields?

12. Squares using vbCrLf or Chr(13)

 

 
Powered by phpBB® Forum Software