Solved

TAB?

Posted on 2002-05-15
8
172 Views
Last Modified: 2011-10-03
Hi,

How to insert a tab key between two strings?

e.g

StrA & "   " & StrB


Thanks!
0
Comment
Question by:cplau
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 69

Accepted Solution

by:
Éric Moreau earned 50 total points
ID: 7010845
StrA & vbTab & StrB
0
 
LVL 18

Expert Comment

by:Crash2100
ID: 7011141
or

msgbox StrA & chr(9) & StrB
0
 
LVL 22

Expert Comment

by:rspahitz
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

by:ameba
ID: 7011582
or:
    Dim strA As String, strB As String
    strA = "hello,"
    strB = "world"
    MsgBox Join(Array(strA, strB), vbTab)
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 18

Expert Comment

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

Expert Comment

by:rspahitz
ID: 7011626
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
 
LVL 15

Expert Comment

by:ameba
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

by:rspahitz
ID: 7014159
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now