AnsweredAssumed Answered

Field Calculator VBA ArcGIS 9.3 - how to replace the last three characters of a string?

Question asked by sdrew1 on Sep 22, 2014
Latest reply on Sep 25, 2014 by sdrew1

Hello, I'm a newbie to VBA Script, so any of the below script could be wrong. I'm trying to use Field Calculator to replace any "_10" at the end of a filename (i.e. an entry in a field, in an attribute table) with "_11". Could anyone help me please? Many thanks in advance! sdrew1

 

Pre-logic VBA Script Code

Dim MyStr as string

Dim strLen as integer

 

strLen = Len([FILENAME])

 

If Right([FILENAME],3) = "_10" Then

MyStr = Left([FILENAME], strLen-3)) & "_11"

Else

MyStr = [FILENAME]

End if

 

Filename =

MyStr

Outcomes