x
Solved

# TAB?

Posted on 2002-05-15
Medium Priority
218 Views
Hi,

How to insert a tab key between two strings?

e.g

StrA & "   " & StrB

Thanks!
0
Question by:cplau
• 3
• 2
• 2
• +1

LVL 71

Accepted Solution

Éric Moreau earned 200 total points
ID: 7010845
StrA & vbTab & StrB
0

LVL 18

Expert Comment

ID: 7011141
or

msgbox StrA & chr(9) & StrB
0

LVL 22

Expert Comment

ID: 7011481
Or even....

strNewString = StrA & "x" & StrB
Mid\$(strNewString,Len(StrA)+1,1) = vbTab

or

StrA & "¡" & StrB

where ¡ is the key combination Alt-NumericKeyPad_9

(emoreau get the points for most efficient solution!)
0

LVL 15

Expert Comment

ID: 7011582
or:
Dim strA As String, strB As String
strA = "hello,"
strB = "world"
MsgBox Join(Array(strA, strB), vbTab)
0

LVL 18

Expert Comment

ID: 7011592
since we all have an equally valid answer we should each get 50 points  :-)
0

LVL 22

Expert Comment

ID: 7011626
Hey...I offered two answers...I want 100 points ;)

strCombined = StrA & "~" & StrB
strCombined = replace("~", vbTab) ' assuming StrA does not contain "~"

or

(variation on my first)

strCombined = StrA & "~" & StrB
intDelimPosit = instr(strCombined, "~")
Mid\$(strNewString,intDelimPosit,1) = vbTab

--
My choices are more geared toward replacing a delimiter AFTER the strings are already appended.  (i.e. "insert a tab [character] between two " previously combined strings.)

--
Aso note that if this string is going to be sent as keystrokes to an application, you amy want to replace the "tab key" with a string of spaces instead: String\$(8, " ") or space\$(8)
0

LVL 15

Expert Comment

ID: 7011646
>insert a tab [character]
The question was insert 'tab key'.  Maybe this should be posted in hardware section.  ;-)
0

LVL 22

Expert Comment

ID: 7014159
I was hoping for a comment  :(

"insert a tab key between two strings"

Go to the keyboard and pry off the button next to the "Q" key marked "Tab".  Go to the store and but some twine.  Cut off a piece of twine, then cut it in half.  Place the "Tab" button between the pieces of twine.  Mission accomplished...  LOL...  (Thanks for the idea ameba!)
0

## Featured Post

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.