w.INSERT a + Chr$(13) + Chr$(10)

G

Guest

Hello,
I'm not totally sure what each bit of the above line of code means. Could
somebody explain this to me please? I know that the Chr$() function is used
to return a line feeder character but what does the 13 and the 10 within the
parentheses mean?

w.INSERT a + Chr$(13) + Chr$(10)
w is a Word Basic Object
a is a String

Thank you :)
 
S

Sandra Daigle

Chr$(13) is a Carriage Return, Chr$(10) is a Line Feed. They go back to the
old typewriter days when Carriage Return just moved you back to the
beginning of the line, and linefeed moved you down. The "+" concatenate
these characters onto the end of the string. You could also simply use the
intrinsic constant vbCrLf.
 
G

Guest

I know that the Chr$() function is used
to return a line feeder character but what does the 13 and the 10 within the
parentheses mean?
----
The problem here is that Chr$() does NOT mean to return a line feeder
character.
Chr$() is used to convert a number to it's ASCII Character IE: CHARACTER to
STRING= Chr$()
the lowercase letter a is Chr$(65) if you print Chr$(65) to the screen you
will find an 'a' printed there.

Some of the 255 codes do not print letters. one, number 7? was used to ring
the bell on older teletype machines. numbers 10 & 13 do linefeed and charage
returns (I forget which is which)

So, Chr$() does not do a linefeed... Chr$(13) + Chr$(10) does a linefeed and
a charage return.
 
D

Dirk Goldgar

Lewis said:
----
The problem here is that Chr$() does NOT mean to return a line feeder
character.
Chr$() is used to convert a number to it's ASCII Character IE:
CHARACTER to STRING= Chr$()
the lowercase letter a is Chr$(65) if you print Chr$(65) to the
screen you will find an 'a' printed there.

Some of the 255 codes do not print letters. one, number 7? was used
to ring the bell on older teletype machines. numbers 10 & 13 do
linefeed and charage returns (I forget which is which)

So, Chr$() does not do a linefeed... Chr$(13) + Chr$(10) does a
linefeed and a charage return.

Chr$(13) is a carriage return. Chr$(10) is a line feed.
 
M

margaret bartley

emerb said:
Hello,
I'm not totally sure what each bit of the above line of code means. Could
somebody explain this to me please? I know that the Chr$() function is used
to return a line feeder character but what does the 13 and the 10 within the
parentheses mean?

w.INSERT a + Chr$(13) + Chr$(10)
w is a Word Basic Object
a is a String

Using "+" instead of "&" for the concatenate operator means that if your
variable a
is null or an empty string, the new line will not be created.

If they had written
w.INSERT a & Chr$(13) & Chr$(10)
then there would always be a new line created
 

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