I have no experience with writing code of any kind. I have been able to glean a few tips regarding how to make a VBA from reading a number of trouble shooting posts and the MicroStationVBA.chm, but can someone please answer the following questions in the most simple way they know how? In other words, in layman's terms.
1. What does the variable type Long do?
2. What is an element enumerator?
3. What does adding .Text to a variable type do? For instance, textEl.text
4. I know that a dimensioned variable name as a string can store text, but how do I insert that text back into my VBA? Example:
Someone has helped me get this far with figuring out how to parse text from a selection set
Dim textEl As TextElementSet textEl = ee.Current.AsTextElementDim myText As StringmyText = textEl.Text
I assumed that I can now use the variable myText to insert the text that I have parsed out back into my VBA, but after trying this I found out I could not. Can someone explain to me in layman's terms how to insert a string back into my VBA?
If the language I used is off, please do not take this opportunity to make fun of me as others have, I am very new at this.
P.S. I know about the Learning MicroStation VBA book, I cannot afford it.
Unknown said:Can someone explain to me in layman's terms how to insert a string back into my VBA?
VBA for MicroStation shares many characteristics with VBA for Office and other applications. Some of your questions are generic and apply to all VBA implementations...
Unknown said:What does the variable type Long do?
VBA supports various data types. Some are numeric, some are not (e.g. String). Numeric types include:
You can find more about numeric and other data types by visiting the MSDN web site, or one of any number of other web sites that deal with VBA.
Unknown said:What is an element enumerator?
In general, an enumerator is a mechanism for iterating a collection of objects. MicroStation VBA provides enumerators for several purposes. An ElementEnumerator is used to iterate the components of a complex object, such as a cell or text node.
Unknown said:What does adding .Text to a variable type do?
Objects have properties. Objects that contain text have a Text property. For example, in a VBA UserForm, a TextBox has a Text property. You can get and set the value of that property. In a DGN model, you might have a TextElement object, which also has a Text property.
When you create a variable of a type that can store text, you refer to its Text property using dot notation:
Dim oText As TextElement '... get text element from somewhere Debug.Print "Text element value=" & oText.Text
It's not clear what you mean. Your code snippet declares String variable myText, and you assign myText a value from a TextElement. What do you want to do?
Regards, Jon Summers LA Solutions
Sub Init () Dim oText As TextElement '... get text element somehow Dim content As String content = oText.Text CreateLink content End Sub Sub CreateLink (ByVal content As String) Dim strURL As String strURL = "http://www.google.com" & "/" & content Debug.Print "My URL=" & strURL ' Start a command CadInputQueue.SendKeyin "ELEMENT CREATE LINK URL " & strURL End Sub
The above is incomplete and not tested. Hope it helps!