Dim s1,s2,s3,s As String
For Each dr As DataRow In DataTables("表A").DataRows
If dr("产品型号") > "" Then
s1 = dr("产品型号").ToUpper()
s2 = s1.Replace("I","").SubString(0,2)
s3 = Asc(s2.SubString(0,1))-64
s3 = s3 & iif(s2.SubString(1,1)="C",1,2)
s3 = "0" & (3-s1.SubString(0,3).Replace("I","").Length) & s3
s2 = s1.SubString(s1.IndexOf(s2)+2,s1.IndexOf("X")-s1.IndexOf(s2)-2).Replace(".","")
s = s1.SubString(s1.IndexOf("X")+1)
s =choose(4-s.Length,"0","00","000","") & s &"0000"
s = s3 & choose(4-s2.Length,"0","00","000","") & s2 & s
dr("产品编码") = s
Else
dr("产品编码")=Nothing
End If
Next