gettagname获得的总是带 PI服务器的点名 比如 \\loacalhost\sinusoid 我们往往需要这个 sinusoid
其实这个是很简单的事情 无非是函数用用
下面给出3个方法
1 Dim ParseTagName As String
Dim MyPos As Integer
MyPos = InStr(3, Value1.GetTagName(1), "\", vbTextCompare)
ParseTagName = Right$(Value1.GetTagName(1), Len(Value1.GetTagName(1)) - MyPos)
MsgBox ParseTagName
2 tagname = ThisDisplay.Trend.GetTagName(a)
For i = Len(tagname) To 1 Step -1
If Mid$(tagname, i, 1) = "\" Then
tagname = Mid$(tagname, i + 1)
Exit For
End If
3 Excel 函数实现
=MID(G1,SEARCH("\",G1,3)+1,LEN(G1)-SEARCH("\",G1,3))