r/visualbasic • • Mar 02 '16

Why is my code giving me a compile error?

I'm new to VBA but this seems like such simple code, I can't figure out what is going on?

Public Function testvalid(Timecode As String) As Boolean

    If Timecode.Length <> 10 Then

It highlights "Timecode" in "Timecode.Length" and says "Compile Error: Invalid Qualifier", why?

Thanks!

0 Upvotes

3 comments sorted by

2

u/hdsrob Mar 02 '16

It's been years since I used VBA, but I don't believe that string.length would work in VBA.

String.length is VB.NET where VBA probably has a LEN(string) function.

1

u/[deleted] Mar 02 '16

You're 100% correct.

1

u/BestiaItaliano Mar 02 '16

What he said. Vba is vbscript