# Microsoft Office Application Help - Excel Help forum > Excel Programming / VBA / Macros >  >  IsString

## 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.

----------


## Tom Ogilvy

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.

--
Regards,
Tom Ogilvy


"Ian Parker" wrote:

> 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.
>
>

----------


## 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


"Ian Parker" <ian@ianbparker.co.uk> wrote in message
news:b2fba1298628f72c4201d3099e3489a0$1@www.dotxls.com...
>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.
>

----------


## ianbparker@gmail.com

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

Bernie Deitrick wrote:
> 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
>
>
> "Ian Parker" <ian@ianbparker.co.uk> wrote in message
> news:b2fba1298628f72c4201d3099e3489a0$1@www.dotxls.com...
> >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.
> >

----------


## ianbparker@gmail.com

Thank you Tom

vartype(r) = vbString

works for me. I am very grateful.

Ian

----------


## 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)

--
Regards,
Tom Ogilvy


<ianbparker@gmail.com> wrote in message
news:1148836874.159604.233000@u72g2000cwu.googlegroups.com...
> 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
>
> Bernie Deitrick wrote:
> > 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
> >
> >
> > "Ian Parker" <ian@ianbparker.co.uk> wrote in message
> > news:b2fba1298628f72c4201d3099e3489a0$1@www.dotxls.com...
> > >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.
> > >
>

----------

