[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 217
  • Last Modified:

TAB?

Hi,

How to insert a tab key between two strings?

e.g

StrA & "   " & StrB


Thanks!
0
cplau
Asked:
cplau
  • 3
  • 2
  • 2
  • +1
1 Solution
 
Éric MoreauSenior .Net ConsultantCommented:
StrA & vbTab & StrB
0
 
Crash2100Commented:
or

msgbox StrA & chr(9) & StrB
0
 
rspahitzCommented:
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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
amebaCommented:
or:
    Dim strA As String, strB As String
    strA = "hello,"
    strB = "world"
    MsgBox Join(Array(strA, strB), vbTab)
0
 
Crash2100Commented:
since we all have an equally valid answer we should each get 50 points  :-)
0
 
rspahitzCommented:
Hey...I offered two answers...I want 100 points ;)

And what about:

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
 
amebaCommented:
>insert a tab [character]
The question was insert 'tab key'.  Maybe this should be posted in hardware section.  ;-)
0
 
rspahitzCommented:
I was hoping for a comment  :(

hmmm I'll add my own:

"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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now