<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://communities.bentley.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>[VBA] In Need of Layman&amp;#39;s Terms</title><link>https://communities.bentley.com/products/programming/microstation_programming/f/microstation-programming---forum/105488/vba-in-need-of-layman-s-terms</link><description>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</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: [VBA] In Need of Layman's Terms</title><link>https://communities.bentley.com/thread/317745?ContentTypeID=1</link><pubDate>Thu, 19 Mar 2015 14:58:17 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:7c279dce-93f0-4190-9d31-c269163bccef</guid><dc:creator>Jon Summers</dc:creator><description>&lt;p&gt;[quote user=&amp;quot;Jeff Dragowski&amp;quot;]Can you tell me what Debug.Print does?[/quote]&lt;/p&gt;
&lt;p&gt;It writes your message to the VBA IDE&amp;#39;s &lt;em&gt;Immediate&lt;/em&gt; window.&amp;nbsp; It&amp;#39;s useful when you want to confirm that your logic is doing what you think it should be doing.&amp;nbsp; In my example abov, it prints the URL so you can see what the &lt;em&gt;link&lt;/em&gt; will get.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Only you, the developer, can see Debug.Print output.&amp;nbsp; A normal user of your macro can&amp;#39;t see it.&lt;/p&gt;
&lt;p&gt;[quote user=&amp;quot;Jeff Dragowski&amp;quot;] Do people use &amp;quot;Dim ee As ElementEnumerator&amp;quot; because it does something[/quote]&lt;/p&gt;
&lt;p&gt;It declares a variable named &lt;em&gt;ee&lt;/em&gt; whose type is &lt;em&gt;ElementEnumerator&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;[quote user=&amp;quot;Jeff Dragowski&amp;quot;]Do people just not want to type ElementEnumerator over and over?[/quote]&lt;/p&gt;
&lt;p&gt;Probably they don&amp;#39;t, but there&amp;#39;s no need to.&amp;nbsp; Usually you declare a single variable of that particular type and use it once in your procedure.&amp;nbsp; You&amp;#39;ll find examples in &lt;a href="http://www.la-solutions.co.uk/content/MVBA/MVBA-Tips.htm#VbaHelp" target="_blank" title="LA Solutions: About MicroStation VBA Help"&gt;VBA help&lt;/a&gt; .&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [VBA] In Need of Layman's Terms</title><link>https://communities.bentley.com/thread/317739?ContentTypeID=1</link><pubDate>Thu, 19 Mar 2015 14:52:46 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:8c6312ee-0387-4882-b2e8-faca85d79a9c</guid><dc:creator>Jeff Dragowski</dc:creator><description>Nevermind, I just read what Debug.Print does.  But my question about declaring variables with Dim still stands.  Is Dim just a time saver when it comes to variable types (ex: a user no longer has to worry about spelling, etc.)?  Or does declaring a variable serve some other function?&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [VBA] In Need of Layman's Terms</title><link>https://communities.bentley.com/thread/317737?ContentTypeID=1</link><pubDate>Thu, 19 Mar 2015 14:47:12 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:5c65ec1c-91d3-47c7-bcdb-73b229b9c2c2</guid><dc:creator>Jeff Dragowski</dc:creator><description>Thanks Jon, I&amp;#39;ll play with this and see what I can do.  Any chance you could answer two more questions for me though?&lt;br /&gt;
&lt;br /&gt;
1.  Do people use &amp;quot;Dim ee As ElementEnumerator&amp;quot; because it does something, or do people just not want to type ElementEnumerator over and over?&lt;br /&gt;
&lt;br /&gt;
2.  Can you tell me what Debug.Print does?  In layman&amp;#39;s terms?&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [VBA] In Need of Layman's Terms</title><link>https://communities.bentley.com/thread/317700?ContentTypeID=1</link><pubDate>Thu, 19 Mar 2015 09:46:10 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:b423f80e-77e4-4b06-9a29-c428377c1810</guid><dc:creator>Jon Summers</dc:creator><description>&lt;pre class="brush: vb; fontsize: 100; first-line: 1; "&gt;Sub Init ()
  Dim oText As TextElement
  &amp;#39;... 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 = &amp;quot;http://www.google.com&amp;quot; &amp;amp; &amp;quot;/&amp;quot; &amp;amp; content
  Debug.Print &amp;quot;My URL=&amp;quot; &amp;amp; strURL
  &amp;#39; Start a command
  CadInputQueue.SendKeyin &amp;quot;ELEMENT CREATE LINK URL &amp;quot; &amp;amp; strURL
End Sub    
&lt;/pre&gt;
&lt;p&gt;The above is incomplete and not tested. Hope it helps!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [VBA] In Need of Layman's Terms</title><link>https://communities.bentley.com/thread/317627?ContentTypeID=1</link><pubDate>Wed, 18 Mar 2015 17:16:00 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:1378bdea-df1f-4ff4-b80b-795ff529f03e</guid><dc:creator>Jeff Dragowski</dc:creator><description>Jon,&lt;br /&gt;
         Thank you for the quick and informative answers to my questions.  My goal is to create a VBA that will do the following once I select a text element in a level [the text content are numbers (1, 2, 3, 4, etc.)] and then run my VBA:&lt;br /&gt;
&lt;br /&gt;
•I want to be able to select one text element, parse its content as a number and attach this number to a defined general URL [as a reference ID (www.webpage.com/1, www.webpage.com/2, www.webpage.com/3, www.webpage.com/4, www.webpage.com/etc.].&lt;br /&gt;
•The result should be attached to the selected element as a URL link.&lt;br /&gt;
&lt;br /&gt;
I developed the following VBA that does not parse the content from the text element I have selected, instead it only attaches a general URL and then immediately opens &amp;quot;links edit&amp;quot; so I can type in the reference ID myself.  I would like to skip the last step, but I do not know how to use the variable type &amp;quot;String&amp;quot; properly:&lt;br /&gt;
&lt;br /&gt;
Sub Macro1()&lt;br /&gt;
    Dim startPoint As Point3d&lt;br /&gt;
    Dim point As Point3d, point2 As Point3d&lt;br /&gt;
    Dim lngTemp As Long&lt;br /&gt;
&lt;br /&gt;
&amp;#39;   Start a command&lt;br /&gt;
    CadInputQueue.SendKeyin &amp;quot;ELEMENT CREATE LINK URL &lt;a href="http://www.google.com"&gt;http://www.google.com&lt;/a&gt;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;#39;   Send a keyin that can be a command string&lt;br /&gt;
    CadInputQueue.SendKeyin &amp;quot;links edit&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;#39;   Send a data point to the current command&lt;br /&gt;
    point.X = startPoint.X&lt;br /&gt;
    point.Y = startPoint.Y&lt;br /&gt;
    point.Z = startPoint.Z&lt;br /&gt;
    CadInputQueue.SendDataPoint point, 1&lt;br /&gt;
&lt;br /&gt;
    CommandState.StartDefaultCommand&lt;br /&gt;
End Sub&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [VBA] In Need of Layman's Terms</title><link>https://communities.bentley.com/thread/317621?ContentTypeID=1</link><pubDate>Wed, 18 Mar 2015 16:50:05 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:a18d9c36-8abb-4e03-bc04-51236e6f6778</guid><dc:creator>Jon Summers</dc:creator><description>&lt;p&gt;[quote user=&amp;quot;Jeff Dragowski&amp;quot;]Can someone explain to me in layman&amp;#39;s terms how to insert a string back into my VBA?[/quote]Welcome to the world of VBA!&amp;nbsp; There&amp;#39;s plenty of jargon to learn&amp;nbsp; 8-)&lt;/p&gt;
&lt;p&gt;VBA for MicroStation shares many characteristics with VBA for Office and other applications.&amp;nbsp; Some of your questions are generic and apply to all VBA implementations...&lt;/p&gt;
&lt;p&gt;[quote user=&amp;quot;Jeff Dragowski&amp;quot;]What does the variable type Long do?[/quote]&lt;/p&gt;
&lt;p&gt;VBA supports various data types.&amp;nbsp; Some are numeric, some are not (e.g. String).&amp;nbsp; Numeric types include:&lt;/p&gt;
&lt;table style="width:70%;" align="left" border="0"&gt;
&lt;tbody&gt;
&lt;tr&gt;&lt;th width="20%"&gt;&lt;em&gt;Type Name&lt;/em&gt;&lt;/th&gt;&lt;th&gt;&lt;em&gt;Comment&lt;/em&gt;&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Integer&lt;/td&gt;
&lt;td&gt;Whole number 16 bits&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Long&lt;/td&gt;
&lt;td&gt;Whole number 32 bits&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Double&lt;/td&gt;
&lt;td&gt;Floating-point (decimal) number 64 bits&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Float&lt;/td&gt;
&lt;td&gt;Floating-point&amp;nbsp;(decimal) number 32 bits&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;You can find more about numeric and other data types by visiting the &lt;a target="_blank" title="Microsoft Developer Network" href="https://msdn.microsoft.com/en-us/default.aspx"&gt;MSDN &lt;/a&gt;web site, or one of any number of other web sites that deal with VBA.&lt;/p&gt;
&lt;p&gt;[quote user=&amp;quot;Jeff Dragowski&amp;quot;]What is an element enumerator?[/quote]&lt;/p&gt;
&lt;p&gt;In general, an &lt;em&gt;enumerator&lt;/em&gt; is a mechanism for iterating a collection of objects.&amp;nbsp; MicroStation VBA provides enumerators for several purposes.&amp;nbsp; An &lt;em&gt;ElementEnumerator&lt;/em&gt; is used to iterate the components of a complex object, such as a cell or text node.&lt;/p&gt;
&lt;p&gt;[quote user=&amp;quot;Jeff Dragowski&amp;quot;]What does adding .Text to a variable type do?[/quote]&lt;/p&gt;
&lt;p&gt;Objects have properties.&amp;nbsp; Objects that contain text have a &lt;em&gt;Text&lt;/em&gt; property.&amp;nbsp; For example, in a VBA UserForm, a &lt;em&gt;TextBox&lt;/em&gt; has a &lt;em&gt;Text&lt;/em&gt; property.&amp;nbsp; You can &lt;em&gt;get&lt;/em&gt; and &lt;em&gt;set&lt;/em&gt; the value of that property.&amp;nbsp; In a DGN model, you might have a &lt;em&gt;TextElement&lt;/em&gt; object, which also has&amp;nbsp;a &lt;em&gt;Text&lt;/em&gt; property.&lt;/p&gt;
&lt;p&gt;When you create a variable of a type that can store text, you refer to its &lt;em&gt;Text&lt;/em&gt; property using &lt;em&gt;dot&lt;/em&gt; notation:&lt;/p&gt;
&lt;pre class="brush: vb; fontsize: 100; first-line: 1; "&gt;Dim oText As TextElement
&amp;#39;... get text element from somewhere
Debug.Print &amp;quot;Text element value=&amp;quot; &amp;amp; oText.Text&lt;/pre&gt;
&lt;p&gt;[quote user=&amp;quot;Jeff Dragowski&amp;quot;]Can someone explain to me in layman&amp;#39;s terms how to insert a string back into my VBA?[/quote]&lt;/p&gt;
&lt;p&gt;It&amp;#39;s not clear what you mean.&amp;nbsp; Your code snippet declares &lt;em&gt;String&lt;/em&gt; variable &lt;em&gt;myText&lt;/em&gt;, and you assign &lt;em&gt;myText&lt;/em&gt; a value from a &lt;em&gt;TextElement&lt;/em&gt;.&amp;nbsp; What do you want to do?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>