#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default IsString

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.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default IsString

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.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default IsString

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" wrote in message
.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.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default IsString

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" wrote in message
.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.


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default IsString

Thank you Tom

vartype(r) = vbString

works for me. I am very grateful.

Ian



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default IsString

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


wrote in message
oups.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" wrote in message
.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.




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 02:00 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"