To start this I know VBA and use VB.Net frequently, but I have never used to in Microstation and I just came across an instance where is would help me very much. I have around six hundred text values that are numeric strings. I have a factor that I need to reduce them by lets say 0.6
I am not sure how the VBA projects are implemented in MS or how you would call "Selected" to a Dim in the project. and then return it back to MS.
It would work much like the Text increment function, Value*.6 instead of Value+1
There are a lot of MVBA materials for your learning. I recommend two of them to you. The first is MVBA online help file MicroStationVBA.chm which is under the folder ...\MicroStation after you installed MicroStation. The second is a published book Learning MicroStation VBA.
Regards, YongAn
Thanks for the links! Using those I got to this so far and I think I understand how the implementation of VB works with Microstation. Im having trouble figuring out how to handle string values as numbers from the text elements still though.
Public Sub ChangeText()
Dim oElEnum As ElementEnumerator
Dim oEl As TextElement
Dim Int1 As Integer
Set oElEnum = ActiveModelReference.GetSelectedElements
oElEnum.Reset
While oElEnum.MoveNext
Set oEl = oElEnum.Current
' oEl.text to Integer = Int1
' Int1 = Int1 * 0.6
' oEl.Text = Int1
oEl.Redraw msdDrawingModeNormal
oEl.Rewrite
Wend
End Sub
Hi,
Try something like this...
oEl.Text = Int(0.6*val(oEl.Text))
--Robert
Answer Verified By: maat7043