[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

what is the function which can ...

Posted on 2002-05-03
4
Medium Priority
?
161 Views
Last Modified: 2010-05-02
Hi,

if S = "Ray 14" , are there any VB function makes me, by using it, let SS = "Ray"
notes: i cannot use (Left) function because S could be more than 3 letters

ex:
Dim S as string, SS as string
S = "Ray  14"
SS = something(S)

by runinng this code : SS = "Ray"

I look forward your code and help.

Thanks
Ray14
0
Comment
Question by:ray14
  • 2
4 Comments
 
LVL 4

Expert Comment

by:RichW
ID: 6989279
Dim i As Integer
S = "Ray 14"
i = InStr(1, S, " ")
SS = Mid(S, 1, i - 1)
0
 
LVL 28

Expert Comment

by:vinnyd79
ID: 6989288
if your using vb6 you could use the split function

Dim S As String
Dim SS() As String
S = "Ray  14"
SS = Split(S, " ")
MsgBox SS(0)
0
 
LVL 4

Expert Comment

by:RichW
ID: 6989307
I would've used Split, but the asker said he wanted SS="Ray". 6 of one, half a dozen of the other.

Cheers,

RichW




0
 
LVL 1

Accepted Solution

by:
vbWayne earned 200 total points
ID: 6990046
You can still use the split as vinnyd79 has indicated.

Dim S As String
Dim RR As Variant
S = "Ray  14"
RR = Split(S)
SS = RR(0)  ' SS = Ray

Msgbox SS

0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses
Course of the Month18 days, 12 hours left to enroll

834 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