AnsweredAssumed Answered

Label Expression not working in Pro

Question asked by lissajo64 on Jun 12, 2018
Latest reply on Jun 21, 2018 by lissajo64

I have a couple of label expressions that I have used many times in ArcMap, but now trying to use them in Pro they no longer work and throw an error.  I am using VBScript and have the Language set as such.

The code is pasted below.  It basically goes through and finds a last name, first name and outputs the Last Name comma First letter of first name and first letter of third name from the first 3 words with the acreage (for example Jones, D. R.), that part works,

then it goes through and finds strings that don't have a comma (those are business names) and outputs the first full word period second word first letter period third word first letter period (for example Union Electric Company would be Union E. C.)  The error is thrown from the code in bold at the bottom. The first part works but I have tried adding and taking away the other array strings from the split function and they are what is throwing the error.  Again it has always worked fine in ArcMap!


The error is Invalid Expression Error 10 on line 0.  Subscript out of range: '[number:1] :

Function FindLabel ( [OwnName1], [ACRES] )

Dim sWords

If IsNull ( [OwnName1] ) then

FindLabel="No Data"


If InStr( [OwnName1]  ,",")  <>0 then

sWords = Split( [OwnName1]  , " ")

FindLabel = Left(sWords(0),12) & Left(sWords(1),1)& "  " & Left(sWords(2),1) & ". " & Round( [ACRES]  ,0)


sWords = Split( [OwnName1] , " ")

FindLabel = Left(sWords(0),12) & " " & Left(sWords(1),1)& "." & Left(sWords(2),1) & ".  "& Round( [ACRES]  ,0)

end if

end if

End Function


Thanks in advance for any insight you can give me~