Adding a <Tab> button press

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

When using VBA to export data, how do you signal a tab button press?

/r or \r is a return, i thought you could do the same for a tab.

true or not?
 
In
Mike said:
When using VBA to export data, how do you signal a tab button press?

/r or \r is a return, i thought you could do the same for a tab.

true or not?

Not. VBA strings don't have escape sequences like C and Java, so "\r"
and "\t" (what you would be looking for in C) don't have special
interpretations. You can embed a tab character in your string by
concatenating in the value of Chr(9), or the vbTab defined constant.
For example,

strMyString = "Field1" & Chr(9) & "Field2"
or
strMyString = "Field1" & vbTab & "Field2"

A carriage return is Chr(13) (defined constant vbCr), and a line feed is
Chr(10) (defined constant vbLf). Access uses the combination of
carriage return and line feed as a newline sequence, and provides the
defined constants vbCrLf and vbNewLine to represent that combination.
 
Back
Top