IsString

I

Ian Parker

I have used the VBA function IsString in the past and I do not remember
any problems. I have upgraded to Office 2003 and suddenly I can not test
if a member of a record set is a string. Please tell me if there is a new
or another old way that still works.

There seems to be a IsNum but no IsString.
 
G

Guest

maybe you used

set r = activecell.Range

application.IsText(r)

or
if vartype(r) = vbString

or
typename(r.value) = "String"

there is an Isnumeric, but that checks if the variable can be evaluated or
treated as a number - it could be stored as a string.
 
B

Bernie Deitrick

Ian,

Perhaps?

If Application.IsText(yourValue) Then
MsgBox "That was a string"
Else
MsgBox "That wasn't a string"
End If

HTH,
Bernie
MS Excel MVP
 
I

ianbparker

Thank you all for replying. You all mention 'Application.IsText' . When
I try this out my version of Excel/BA 2003 does not seem to have this
function.

Do I have to add some specific DLL to load the IsText functionality?

I am very grateful for people helping me out as I have limited access
to written information.

My situation is that I have just got a record set via a SQL query. I
need to test if the 3rd element in the record set is a string so that I
may process it correctly or tell the user of the macro that the
database might be corrupt.

Ian
 
T

Tom Ogilvy

istext is a worksheet function

go into a cell and type

=istext(A1)

Perhaps you are looking at intellisense or the object browser to say you
don't have it rather than just trying it. It is certainly available.

In the object browser you would see it under the Worksheetfunction object.

so you can do (? is for use in the immediate window)

? application.WorksheetFunction.IsText(r)

or

? WorksheetFunction.IsText(r)

or

? Application.IsText(r)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top