How can I add a tab character into a string

M

mcambrose

I read a string such as "orientation training" from a table I know how to
parse the string to break it into two words and save each to a separate
variable, but how can I add a tab in front of the contents of a string
variable, so that when I place the text in the document it will be tabbed
from the left. I'm assuming I can do this by adding the tab character before
the second word. For example I tried the code mystring = "^T" & mystring to
try to add a tab before the contents of mystring. It did not seem to make any
difference when I place my string into the document. Please, what am I
missing. I am using the contents of mystring to replace text in the document.
I want the text tabbed over from the left, so that is why I want to add a
tab.

THanks.
 
K

Karl E. Peterson

mcambrose said:
how can I add a tab in front of the contents of a string variable,

sVar = vbTab & sVar
or
sVar = Chr$(9) & sVar
or
sVar = Chr$(vbKeyTab) & sVar
 

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