[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

what is the function which can ...

Posted on 2002-05-03
4
Medium Priority
?
160 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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…
Suggested Courses

649 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