Hi,I've got a featureclass that I'm trying to join ~50 tables to. I built a model in model builder that relies on "Join Field" to do the joining. But, I want to rename all the newly joined fields in the featureclass to different names. So, I wrote a VBA script to do it. I can rename the fields, but the changes do not persist. By that, I mean that I can open the attribute table in ArcMap after I've run the script, and the field names are changed. However, if I close ArcMap and reopen it, the field names revert to their original name. Or, while ArcMap is still open after running the script, the table preview in ArcCatalog reflects no change. I tried this with both a shapefile and a FGDB FeatureClass.And, if I view the attribute table with the renamed fields and try to export it, the resulting table does *not* include the newly joined fields at all!I did find a workaround. Once I rename the fields using my script below, I use the geoprocessing tool "Copy Rows" to create a new table. I can then build that back to a feature class by creating events based on X-Y coordinates also in the table. But, I 'm still curious why IFieldEdit2.name won't make a permanent name change.Here's what my code looks like for renaming one field. I also did this in .NET by setting IFieldEdit.Name_2, but with the same results.
Public Sub go()
Dim pfc As IFeatureClass
Dim pmap As IMap
Dim pdoc As IMxDocument
Set pdoc = ThisDocument
Set pmap = pdoc.FocusMap
Dim pflayer As IFeatureLayer
Set pflayer = pmap.Layer(0)
Set pfc = pflayer.FeatureClass
Dim i As Integer
Dim layername As String
'this is what I want to rename the field to
layername = "MyNewName"
Dim pfield As IField
Dim pfieldedit As IFieldEdit2
Dim lfld As Integer
'this is the original field name
lfld = pfc.FindField("NEAR_DIST")
Set pfield = pfc.Fields.Field(lfld)
Set pfieldedit = pfield
pfieldedit.Name = layername
End Sub