<?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>capture text element content (string) and re-use to attach ref</title><link>https://communities.bentley.com/products/programming/microstation_programming/f/microstation-programming---forum/176490/capture-text-element-content-string-and-re-use-to-attach-ref</link><description>Hello, 
 Question with moving old V8i MicroStation Basic to Connect Edition VBA (or macro recorder). 
 Starting from a DGN that has a rectangular matrix (mesh/ grid?) over the map of the country. In each case (box) of the DGN matrix we have a text element</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: capture text element content (string) and re-use to attach ref</title><link>https://communities.bentley.com/thread/512994?ContentTypeID=1</link><pubDate>Mon, 25 Mar 2019 10:18:19 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:674a78e6-6347-49ba-a0d5-779f3812d516</guid><dc:creator>NicolasT</dc:creator><description>&lt;p&gt;Thank you Jan, I figured it out meanwhile. Many thanks for your contribution. : best regards, Nico&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: capture text element content (string) and re-use to attach ref</title><link>https://communities.bentley.com/thread/512776?ContentTypeID=1</link><pubDate>Fri, 22 Mar 2019 15:27:29 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:0a79b768-9f08-49ad-9e4f-2c7614f77f29</guid><dc:creator>Jon Summers</dc:creator><description>[quote userid="279028" url="~/products/programming/microstation_programming/f/microstation-programming---forum/176490/capture-text-element-content-string-and-re-use-to-attach-ref/512771"]How can I make the VBA also select text (datapoint) from the reference files[/quote]
&lt;p&gt;Assuming that you&amp;#39;ve written a class that &lt;code&gt;Implements ILocateCommandEvents&lt;/code&gt;, then you can modify the &lt;code&gt;_Start&lt;/code&gt; method.&amp;nbsp; You can see this example (&lt;em&gt;Analyze Arc)&lt;/em&gt; in VBA help...&lt;/p&gt;
&lt;pre&gt;Private Sub ILocateCommandEvents_Start()
  Dim lc As LocateCriteria
  &amp;#39;  Since this command does not modify the original element,
  &amp;#39;  set the locate criteria to allow  read-only elements.
  Set lc = CommandState.CreateLocateCriteria(False)
  CommandState.SetLocateCriteria lc

  ShowCommand &amp;quot;Analyze Arc Example&amp;quot;
  ShowPrompt &amp;quot;Select an arc&amp;quot;
End Sub
&lt;/pre&gt;
&lt;p&gt;The relevant part is &lt;code&gt;LocateCriteria&lt;/code&gt;.&amp;nbsp; Reference attachments are read-only, so copy this code to do what you want.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: capture text element content (string) and re-use to attach ref</title><link>https://communities.bentley.com/thread/512771?ContentTypeID=1</link><pubDate>Fri, 22 Mar 2019 14:58:14 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:07dba70e-62ca-4afc-9b7e-cfda089932fa</guid><dc:creator>NicolasT</dc:creator><description>&lt;p&gt;Thank you very much indeed Jon, and Jan :)&lt;/p&gt;
&lt;p&gt;Sorry for the delay -doing too many things at the same time - I succeeded in getting my VBA to&amp;nbsp;work.&amp;nbsp;Now it&amp;nbsp;works fine on the text elements I select (Datapoint) on text in my active file. But the text from reference files do not not get selected when clicking on it. While the MicroStation select function works OK, so all refs have locate on.&lt;/p&gt;
&lt;p&gt;How can I make the VBA also select text (datapoint) from the reference files. Searching for doc about this&amp;nbsp;seems only to activate one single ref.&lt;/p&gt;
&lt;p&gt;Thank you very much in advance for your advice,&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Nico&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: capture text element content (string) and re-use to attach ref</title><link>https://communities.bentley.com/thread/510776?ContentTypeID=1</link><pubDate>Tue, 12 Mar 2019 15:50:53 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:7bd03f60-289e-4c38-a1c4-0cc3a017f99b</guid><dc:creator>Jan Šlegr</dc:creator><description>&lt;p&gt;Hi Nicolas,&lt;/p&gt;
[quote userid="279028" url="~/products/programming/microstation_programming/f/microstation-programming---forum/176490/capture-text-element-content-string-and-re-use-to-attach-ref"]The VBA should allow to manually&amp;nbsp;select the text in one box (click)[/quote]
&lt;p&gt;if the grid looks ike a regular matrix and both borders and texts can be easily indetified (a combination of level / color is not shared with any other element), it&amp;#39;s even not necessary to select the text. Macro can be written in such way any click into a particular grid would be enough. But of course it requires some extra code to find surrounding grid borders and text inside. When grid is XY oriented (not rotated or slanted), it&amp;#39;s not very complicated.&lt;/p&gt;
&lt;p&gt;With regards,&lt;/p&gt;
&lt;p&gt;&amp;nbsp; Jan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: capture text element content (string) and re-use to attach ref</title><link>https://communities.bentley.com/thread/510744?ContentTypeID=1</link><pubDate>Tue, 12 Mar 2019 13:44:55 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:48ab2579-9796-4431-9d3b-30e84bc4a080</guid><dc:creator>Jon Summers</dc:creator><description>[quote userid="279028" url="~/products/programming/microstation_programming/f/microstation-programming---forum/176490/capture-text-element-content-string-and-re-use-to-attach-ref"]I searched a lot but can not find the trick to save that text content in a var in VBA[/quote]
&lt;pre&gt;&lt;span style="color:seagreen;"&gt;&amp;#39; Locate a text element&lt;/span&gt;
Dim oText As TextElement
&lt;span style="color:seagreen;"&gt;...&lt;/span&gt;
Dim strMapID As String
strMapID = oText.Text &amp;amp; &amp;quot;.tif&amp;quot;
Debug.Print &amp;quot;Map ID=&amp;quot; &amp;amp; strMapID
&lt;/pre&gt;
[quote userid="279028" url="~/products/programming/microstation_programming/f/microstation-programming---forum/176490/capture-text-element-content-string-and-re-use-to-attach-ref"]The VBA should allow to manually select the text[/quote]
&lt;p&gt;Write a class that &lt;code&gt;Implements ILocateCommandEvents&lt;/code&gt;.&amp;nbsp; Some of the &lt;a title="LA Solutions: VBA examples (search for Text)" href="http://www.la-solutions.co.uk/content/CONNECT/MVBA/ArticleIndex-MVBA.htm" rel="noopener noreferrer" target="_blank"&gt;examples here&lt;/a&gt; show how to use that interface.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>