<?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>Select text from level</title><link>https://communities.bentley.com/products/programming/microstation_programming/f/archived-microstation-v8i-vba-forum/68897/select-text-from-level</link><description>Hello all, 
 I am creating a module and I want to select only text in one level. Could you please help me with that!? 
 The thing I wrote until now: 
 CadInputQueue.SendCommand &amp;quot;CHOOSE ELEMENT &amp;quot; 
 CadInputQueue.SendCommand &amp;quot;POWERSELECTOR AREA BLOCK</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>Re: Select text from level</title><link>https://communities.bentley.com/thread/179193?ContentTypeID=1</link><pubDate>Tue, 26 Jul 2011 22:49:16 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:25f5a267-a787-470d-a49c-895b075b4cb2</guid><dc:creator>Mike Robertson</dc:creator><description>&lt;p&gt;I agree with Phil, a more elegant (and non-intrusive method would be to use Element Enumerator).&lt;/p&gt;
&lt;p&gt;Here&amp;#39;s some example code (been a while since I&amp;#39;ve done VBA but this should work).&lt;/p&gt;
&lt;p&gt;Dim textLevel As Level&lt;/p&gt;
&lt;p&gt;Set textLevel = ActiveDesignFile.Levels(&amp;quot;text&amp;quot;)&lt;/p&gt;
&lt;p&gt;Dim scanCrit As ElementScanCriteria&lt;/p&gt;
&lt;p&gt;scanCrit.ExcludeAllTypes&lt;/p&gt;
&lt;p&gt;scanCrit.IncludeType (msdElementTypeText)&lt;/p&gt;
&lt;p&gt;scanCrit.IncludeType (msdElementTypeTextNode)&lt;/p&gt;
&lt;p&gt;scanCrit.IncludeLevel (textLevel)&lt;/p&gt;
&lt;p&gt;Dim eleEnum As ElementEnumerator&lt;/p&gt;
&lt;p&gt;&amp;#39;this returns all the text and text node element on &amp;quot;text&amp;quot; level&lt;/p&gt;
&lt;p&gt;Set eleEnum = ActiveModelReference.Scan(scanCrit)&lt;/p&gt;
&lt;p&gt;Do While eleEnum.MoveNext&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;#39;you can change attributes or text inside the element here &lt;/p&gt;
&lt;p&gt;Loop&lt;/p&gt;
&lt;p&gt;Look at the &amp;quot;Scan Method&amp;quot; in the VBA documentation for some great examples&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: Select text from level</title><link>https://communities.bentley.com/thread/179097?ContentTypeID=1</link><pubDate>Tue, 26 Jul 2011 14:51:09 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:eb8bb806-a27e-4389-b046-b83ed8faef85</guid><dc:creator>Phil Chouinard</dc:creator><description>&lt;p&gt;A low-tech solution could be to replace&lt;/p&gt;
&lt;p&gt;&lt;code&gt;CadInputQueue.SendCommand &amp;quot;CHOOSE ELEMENT &amp;quot;&lt;br /&gt;CadInputQueue.SendCommand &amp;quot;POWERSELECTOR AREA BLOCK &amp;quot;&lt;br /&gt;CadInputQueue.SendCommand &amp;quot;POWERSELECTOR MODE ADD &amp;quot;&lt;br /&gt;CadInputQueue.SendKeyin &amp;quot;level element select &amp;quot;&amp;quot;level name&amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;..Now I want to select only! the text in &amp;ldquo;level name&amp;rdquo; and put it &amp;ldquo;active&amp;rdquo; to use it for the following:&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;with&lt;/p&gt;
&lt;p&gt;&lt;code&gt;CadInputQueue.SendKeyin &amp;quot;mdl silentload selectby;selectby type none;selectby type text;selectby level Text;selectby execute&amp;quot;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;(watch word-wrapping... that is all one statement) where Text in selectby level is the name of the level that you want to &amp;quot;isolate&amp;quot;. A more elegant approach would be to implement a criteria scan.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>