Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

variant into string

Posted on 2006-06-16
5
Medium Priority
?
627 Views
Last Modified: 2010-04-30
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
Comment
Question by:Autofreak
5 Comments
 
LVL 96

Accepted Solution

by:
Lee W, MVP earned 260 total points
ID: 16924405
CStr(Variant)
0
 
LVL 15

Assisted Solution

by:JackOfPH
JackOfPH earned 80 total points
ID: 16925672
dim x
dim y as string

y = cstr(x)
0
 
LVL 21

Assisted Solution

by:alainbryden
alainbryden earned 80 total points
ID: 16925864
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
 
LVL 8

Assisted Solution

by:kaliyugkaarjun
kaliyugkaarjun earned 80 total points
ID: 16933332
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
 

Author Comment

by:Autofreak
ID: 16964476
Thank you Guys, all answeres halped me.
Serge
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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 utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

971 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