Improve company productivity with a Business Account.Sign Up

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

variant into string

Hello Guys,
                  I got a string value "A" in a variant array that shows Variant/String type for the string's values. However,
the functions recieving the array's values compalin of type mismatch. How do convert variant into string???

Thanks,
Serge
0
Autofreak
Asked:
Autofreak
4 Solutions
 
Lee W, MVPTechnology and Business Process AdvisorCommented:
CStr(Variant)
0
 
JackOfPHCommented:
dim x
dim y as string

y = cstr(x)
0
 
alainbrydenCommented:
you should probably check just to be sure:

Dim x as integer
Dim StrResult As String
Dim VarArray() As Variant
...
...
If isAlphaNumeric( VarArray(x) ) then
   StrResult = CStr( VarArray(x) )
Else
   StrResult = vbNullString
End If
0
 
kaliyugkaarjunCommented:
I think u need to loop through the variant and for each item in a variant (i.e. variant_array_name(0), variant_array_name(1),.....) use function cstr() to convert it to string...

0
 
AutofreakAuthor Commented:
Thank you Guys, all answeres halped me.
Serge
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now