Hey, how would i put ANYTHING
between 2 "'s into a variable
like:
"Nobody Knows"
then Variable(1) = Nobody Knows
but it could be anyamount of words, 1 or 15, it doesn't matter
THANKS
Printable View
Hey, how would i put ANYTHING
between 2 "'s into a variable
like:
"Nobody Knows"
then Variable(1) = Nobody Knows
but it could be anyamount of words, 1 or 15, it doesn't matter
THANKS
Use
Code:MsgBox """Hello"""
OR
MsgBox Chr(34) & "Hello" & Chr(34)
i guess i didn't explain it enough..
i mean like, i have a textbox, and if someone types something like
"yo" i said, and he said "what up"
var(1) = yo
var(2) = what up
..
so what ever is INBETWEEN 2 "'s would go into a variable..
and i could have many variables..
Thanks
Can you explain yourself just a bit more? What do you mean so what ever is INBETWEEN 2 "'s would go into a variable.. ?
Do you mean spaces? You could use the split function, put it into arrays.
^should get you started.Code:Private Sub Command1_Click()
Dim vArray As Variant
Dim strArray As String
Dim iArray As Integer
vArray = Split(Text1.Text, " ")
For i = 0 To UBound(vArray)
strArray = strArray & vArray(iArray) & vbCrLf
Next i
MsgBox strArray
End Sub
Chr(34) = " 'quote
I think this is what you want!
I put them into a dynamic array.
For instance the sentance : "I am testing" to see "if" this "works" will end up like this:Code:Private Sub Command1_Click()
Dim I As Integer, ArrLen As Integer
Dim Vars() As String
ArrLen = -1
For I = 1 To Len(Text1.Text)
If Mid(Text1.Text, I, 1) = Chr(34) Then
ArrLen = ArrLen + 1
ReDim Preserve Vars(ArrLen)
Vars(ArrLen) = Mid(Text1.Text, I + 1, InStr(I + 1, Text1.Text, Chr(34)) - I - 1)
I = InStr(I + 1, Text1.Text, Chr(34)) + 1
End If
Next
End Sub
Vars(0) = I am testing
Vars(1) = if
Vars(2) = works
Is that what you want? Or am I as confused as the rest of them?