Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default substring method for VBScript

I've been searching for a substr method for VBScript. Is there one?
Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default substring method for VBScript

Use Mid$

MID$(string, start, len)

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

wrote in message
...
I've been searching for a substr method for VBScript. Is there one?
Thanks!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,549
Default substring method for VBScript


VBA and VBS are not the same thing.
Which one are you referring to?
What does your "substr" method do?
What version of Excel do you use?
--
Jim Cone
Portland, Oregon USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)


wrote in message
I've been searching for a substr method for VBScript. Is there one?
Thanks!
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default substring method for VBScript

Hi!
I'm using Excel 2003 - writing a script with VBScript to read in data
from a CSV file.
One of the fields ("Client Name") will be used as the name of a
Worksheet and all the customer's info will be in the worksheet.
The field is free text, and sometimes contains illegal characters (for
Worksheet name) - *?[]\/ - and is sometimes too long.

Replace clientName, "*", "#"
Replace clientName, "\", "|"
Replace clientName, "/", "|"
Replace clientName, "?", "!"
Replace clientName, "[", "{"
Replace clientName, "]", "}"
If Len(clientName) 30 Then
clientName = Substring(clientName, 1, 30)
End If

I don't think these rows work in VBScript...
Thanks for any help,
Mechi


On Jun 4, 3:05*pm, "Jim Cone" wrote:
VBA and VBS are not the same thing.
Which one are you referring to?
What does your "substr" method do?
What version of Excel do you use?
--
Jim Cone
Portland, Oregon *USAhttp://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)

wrote in message

I've been searching for a substr method for VBScript. *Is there one?
Thanks!


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,549
Default substring method for VBScript

If you are using the Visual Basic Editor and not
the Microsoft Script Editor then try...

clientName = Replace(clientName, "*", "#")
clientName = Replace(clientName, "\", "|")
clientName = Replace(clientName, "/", "|")
clientName = Replace(clientName, "?", "!")
clientName = Replace(clientName, "[", "{")
clientName = Replace(clientName, "]", "}")
clientName = Left(clientName, 30)
--
Jim Cone
Portland, Oregon USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)




wrote in message
Hi!
I'm using Excel 2003 - writing a script with VBScript to read in data
from a CSV file.
One of the fields ("Client Name") will be used as the name of a
Worksheet and all the customer's info will be in the worksheet.
The field is free text, and sometimes contains illegal characters (for
Worksheet name) - *?[]\/ - and is sometimes too long.

Replace clientName, "*", "#"
Replace clientName, "\", "|"
Replace clientName, "/", "|"
Replace clientName, "?", "!"
Replace clientName, "[", "{"
Replace clientName, "]", "}"
If Len(clientName) 30 Then
clientName = Substring(clientName, 1, 30)
End If

I don't think these rows work in VBScript...
Thanks for any help,
Mechi




On Jun 4, 3:05 pm, "Jim Cone"
wrote:
VBA and VBS are not the same thing.
Which one are you referring to?
What does your "substr" method do?
What version of Excel do you use?
--
Jim Cone
Portland, Oregon USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)






wrote in message
I've been searching for a substr method for VBScript. Is there one?
Thanks!




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default substring method for VBScript

On Jun 5, 5:31*pm, "Jim Cone" wrote:
If you are using the Visual Basic Editor and not
the Microsoft Script Editor then try...

*clientName = Replace(clientName, "*", "#")
*clientName = Replace(clientName, "\", "|")
*clientName = Replace(clientName, "/", "|")
*clientName = Replace(clientName, "?", "!")
*clientName = Replace(clientName, "[", "{")
*clientName = Replace(clientName, "]", "}")
*clientName = Left(clientName, 30)
--
Jim Cone
Portland, Oregon *USAhttp://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)


wrote in message
Hi!
I'm using Excel 2003 - writing a script with VBScript to read in data
from a CSV file.
One of the fields ("Client Name") will be used as the name of a
Worksheet and all the customer's info will be in the worksheet.
The field is free text, and sometimes contains illegal characters (for
Worksheet name) - *?[]\/ - and is sometimes too long.

Replace clientName, "*", "#"
Replace clientName, "\", "|"
Replace clientName, "/", "|"
Replace clientName, "?", "!"
Replace clientName, "[", "{"
Replace clientName, "]", "}"
If Len(clientName) 30 Then
clientName = Substring(clientName, 1, 30)
End If

I don't think these rows work in VBScript...
Thanks for any help,
Mechi

On Jun 4, 3:05 pm, "Jim Cone"



wrote:
VBA and VBS are not the same thing.
Which one are you referring to?
What does your "substr" method do?
What version of Excel do you use?
--
Jim Cone
Portland, Oregon USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)
wrote in message
I've been searching for a substr method for VBScript. Is there one?
Thanks!- Hide quoted text -


- Show quoted text -


It worked!!!
I'm using VBSedit (free version)
Thanks!
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


Similar Threads
Thread Thread Starter Forum Replies Last Post
extracting substring Rajesh Excel Discussion (Misc queries) 3 January 7th 10 10:23 AM
substring Satyanaidu Excel Discussion (Misc queries) 2 September 11th 09 09:33 AM
Extracting a SubString Brian Excel Discussion (Misc queries) 4 June 28th 07 07:30 PM
Substring Ldyflyr Excel Discussion (Misc queries) 0 February 15th 07 03:16 PM
Substring Petya Excel Discussion (Misc queries) 0 February 15th 07 02:53 PM


All times are GMT +1. The time now is 09:45 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"