# Argument 'Length' must be greater or equal to zero.

### Question

• In my decryption statement i am getting   Argument 'Length' must be greater or equal to zero. is this statement wrong

DecodedStr = Mid(DecodedStr, 1, InStr(DecodedStr, Right(DecodedStr, 4)) - 1)

Monday, June 13, 2011 10:07 AM

• If you do them one by one than you will see

Intermidiate=InStr(DecodedStr, Right(DecodedStr, 4))

DecodedStr = Mid(DecodedStr, 1, Intermidiate - 1)

And even more.

Success
Cor
Monday, June 13, 2011 10:35 AM
• I am not sure what this is all aobut (you didnt say anything what your variables are), so I guess your last -1 is not the correct one.

Try:

```DecodedStr = Mid(DecodedStr, 1, InStr(DecodedStr, Right(DecodedStr, 4)))
```

Or:
```DecodedStr = Mid(DecodedStr, 1, InStr(DecodedStr, Right(DecodedStr, 4) -1))
```

Mitja
Monday, June 13, 2011 10:27 AM

### All replies

• I am not sure what this is all aobut (you didnt say anything what your variables are), so I guess your last -1 is not the correct one.

Try:

```DecodedStr = Mid(DecodedStr, 1, InStr(DecodedStr, Right(DecodedStr, 4)))
```

Or:
```DecodedStr = Mid(DecodedStr, 1, InStr(DecodedStr, Right(DecodedStr, 4) -1))
```

Mitja
Monday, June 13, 2011 10:27 AM
• If you do them one by one than you will see

Intermidiate=InStr(DecodedStr, Right(DecodedStr, 4))

DecodedStr = Mid(DecodedStr, 1, Intermidiate - 1)

And even more.

Success
Cor
Monday, June 13, 2011 10:35 AM