- 积分
- 1898
- 明经币
- 个
- 注册时间
- 2003-6-27
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
本帖最后由 作者 于 2003-8-29 19:05:02 编辑
能否一次将所有文本的数值加上一定的值?
Private Sub CommandButton1_Click()
Dim s As AcadSelectionSet
Dim A As String, I As Single
Dim start As Integer
Dim ed As Integer
Dim s1 As String
Dim s2 As String
Dim ft(0) As Integer
Dim fl(0) As Variant
ft(0) = 0
fl(0) = "text"
Set s = ThisDrawing.SelectionSets.Add("a2a2121")
Me.Hide
s.SelectOnScreen ft, fl
Dim e As AcadText
For Each e In s
'将对象的字符给变量A
A = e.TextString
'获得截取字符串的首位置
start = InStr(1, A, "/")
'获得欲截取数据的结束位置
ed = InStr(1, A, "dBm")
'将前面的字符赋给S1
s1 = Mid(A, 1, start)
'将后面的字符赋给S1
s2 = Mid(A, ed, 3)
'取出数据,并改变
I = Val(Mid(A, start + 1, ed - start))
I = I + 0.8
e.TextString = s1 & I & s2
e.Update
Next e
End Sub
字符串的格式:F1-A1/3.5dBm 楼层-天线/输出功率
F15-A1/-6.5dBm .....
要求,将输出功率加大0.8
请明总指点。 |
|