Michael Paravicini
asked on
InStr looking for spaces does not give the expected result
I am getting old but somehow the following code does not yield the desired result:
xName = "Steven Murray Thomas"
MsgBox InStr(1,xName," ")
gives zero and not the expected 7. Any help why?
Thank you so much Michael
xName = "Steven Murray Thomas"
MsgBox InStr(1,xName," ")
gives zero and not the expected 7. Any help why?
Thank you so much Michael
No. It works fine for me - with a direct copy-paste - returns 7.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Or simply put this statement and see what number it returns. If it doesn't return 32, that means the white space is not the space character.
MsgBox Asc(Mid(xName, 7, 1))
Or just delete your old code and copy-paste your own code here at top … that was what I did.
ASKER
Thank you so much to all of you. It was indeed as Jim said. It as not a space but a ASCI 160 - I now simply replaced it with CHR(32) and it works fine! Thank you.. Cheers Michael