|
-
Sep 27th, 2002, 05:47 PM
#1
Thread Starter
Member
Problem with code - Resolved
Hello,
I'm getting an 'Invalid Procedure call or argument' error on this line. strTemp = Left$(InitialArray(x), InStr(InitialArray(x), "|") - 1)
I can change the '-1' to a '+1' and it works fine but gives me an extra character that I don't want. What I'm trying to to is just get the string up to the delimiter, but not the delimiter. I can't figure out why I keep getting an error. Can somebody please help..
Thanks, Rick
Last edited by rruble88; Sep 27th, 2002 at 08:58 PM.
-
Sep 27th, 2002, 05:50 PM
#2
PowerPoster
Well
Look into the Mid Function
Something Like :
VB Code:
strText = "Text to Trim !"
Mid(strText,1,Len(strText)-1)
This would remove the ! character...
Remaining quiet down here !!!
BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....
-
Sep 27th, 2002, 05:56 PM
#3
I'd also look at the source string.... make sure it doesn;t START with the delimiter
VB Code:
Dim strString As String
strString = "|Col1|Col2"
MsgBox InStr(strString, "|") 'This will return 1
MsgBox InStr(strString, "|") - 1 'This will return 0
MsgBox Left$(strString, InStr(strString, "|") - 1) 'This will error, because you can't get the Left 0 characters.
-
Sep 27th, 2002, 06:20 PM
#4
Thread Starter
Member
Thanks for the replies, I've been looking a code too long today!
I'm replacing a string in the array without adding the delimiter back into it..Thanks again
-
Sep 27th, 2002, 06:22 PM
#5
PowerPoster
Well
Add resolved to your first subject by editing your first post...
Glad you figured it out...
Remaining quiet down here !!!
BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|