<?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>Place Text through VBA</title><link>https://communities.bentley.com/products/programming/microstation_programming/f/microstation-programming---forum/84711/place-text-through-vba</link><description>Hi all, 
 Trying to work out how to place a predefined text string onto the drawing, without bring up any menus or options. 
 Have tried 
 CadInputQueue.SendKeyin &amp;quot;place text&amp;quot; CadInputQueue.SendKeyin sText 
 
 But the keyin window appears and i cant</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Place Text through VBA</title><link>https://communities.bentley.com/thread/322840?ContentTypeID=1</link><pubDate>Fri, 01 May 2015 16:35:37 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:2ba4676a-5830-411e-9267-8c54d8796e82</guid><dc:creator>Derek Schmidt</dc:creator><description>[quote]
&lt;p&gt;dim text as string &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#39; text string&lt;/p&gt;
&lt;p&gt;dim rotmatrix as matrix3d &amp;nbsp; &amp;nbsp; &amp;#39; text rotation&lt;/p&gt;
&lt;p&gt;dim p1 as point3d &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#39; textt origin&lt;/p&gt;
&lt;p&gt;RotMatrix = Matrix3dFromAxisAndRotationAngle(2, 0)&lt;/p&gt;
&lt;p&gt;Set Text = CreateTextElement1(Nothing, &amp;quot;text to be written, P1, RotMatrix)&lt;/p&gt;
&lt;p&gt;ActiveModelReference.AddElement Testo&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;[/quote]
&lt;p&gt;Thanks, blumax, this helped me out a lot, but I&amp;#39;d like to submit a correction and expansion to this like so:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;dim text as TextElement
dim RotMatrix as Matrix3d
dim p1 as Point3d

&amp;#39; insert your own code to specify location of p1 based on your needs
RotMatrix = Matrix3dFromAxisAndRotationAngle(2, 0)

Set text = CreateTextElement1(Nothing, &amp;quot;your text, or a variable string&amp;quot;, p1, RotMatrix)
&amp;#39; now you can set graphic group or any other properties you like, for example:
text.graphicGroup = 15

ActiveModelReference.AddElement text&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: Place Text through VBA</title><link>https://communities.bentley.com/thread/240460?ContentTypeID=1</link><pubDate>Thu, 11 Apr 2013 07:29:38 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:9d7ef943-e217-4ebe-b337-6945546041c9</guid><dc:creator>Rob Golding</dc:creator><description>&lt;p&gt;Perfect Stefan!&lt;/p&gt;
&lt;p&gt;Only 1 small problem though, when the reset button is clicked nothing happens.&lt;/p&gt;
&lt;p&gt;Is it ok to simply add in &amp;quot; &amp;nbsp; &amp;nbsp;CommandState.StartDefaultCommand&amp;quot;&lt;/p&gt;
&lt;p&gt;or when working with classes is it best to do it another way?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: Place Text through VBA</title><link>https://communities.bentley.com/thread/240306?ContentTypeID=1</link><pubDate>Wed, 10 Apr 2013 12:49:45 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:d0b30634-aca6-459f-98ee-8a66504c6620</guid><dc:creator>stefan_bernsdorf</dc:creator><description>&lt;p&gt;Got you wrong Rob.&lt;/p&gt;
&lt;p&gt;I thought you wanted to place a line and a text.&lt;/p&gt;
&lt;p&gt;Please find a example attached.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description><enclosure url="https://communities.bentley.com/cfs-file/__key/telligent-evolution-components-attachments/00-343173-01-00-00-24-03-06/CreateText.mvba" length="23552" type="application/octet-stream" /></item><item><title>Re: Place Text through VBA</title><link>https://communities.bentley.com/thread/240297?ContentTypeID=1</link><pubDate>Wed, 10 Apr 2013 11:36:38 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:8a835906-826b-43ff-b4b3-d4336e1d73c3</guid><dc:creator>Jan Šlegr</dc:creator><description>&lt;p&gt;Hi Rob,&lt;/p&gt;
&lt;p&gt;few notes (not sitting at my computer, so sorry, no code):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Because only the first data point is important for you, you don&amp;#39;t have to count points and you can start dynamics immediately when tool is started.&lt;/li&gt;
&lt;li&gt;The first data point is the place where the text should be added to a model and as Stefan recommends, the tools should be restarted there.&lt;/li&gt;
&lt;li&gt;I prefer (but it&amp;#39;s just personal style) in such case to create text immediately when the tool is started (because you know the text already) at 0,0 coordinates and make it available for the rest of the code. Both in dynamic and datapoint you can use Transform3dFromPoint3d to create Transform3d and use it to shift the text to the dynamic or data point using textElm.Transform method.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;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: Place Text through VBA</title><link>https://communities.bentley.com/thread/240290?ContentTypeID=1</link><pubDate>Wed, 10 Apr 2013 10:52:21 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:2efc4828-7338-492c-a36a-b0ea3e7c35cc</guid><dc:creator>stefan_bernsdorf</dc:creator><description>&lt;p&gt;Some small corrections:&lt;/p&gt;
&lt;p&gt;Private Sub IPrimitiveCommandEvents_Dynamics(Point As Point3d, ByVal View As View, ByVal DrawMode As MsdDrawingMode)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;If m_nPoints = 1 Then&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;m_atPoints(1) = Point&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Dim otext As TextElement&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Set otext = CreateTextElement1(Nothing, m_strText, Point, Matrix3dIdentity)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;otext.Redraw msdDrawingModeTemporary&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;End If&lt;/p&gt;
&lt;p&gt;End Sub&lt;/p&gt;
&lt;p&gt;Private Sub IPrimitiveCommandEvents_Reset()&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;&amp;#39;Better to do a clear reinitialization&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;CommandState.StartPrimitive New MyClass()&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;m_nPoints = 0&lt;/p&gt;
&lt;p&gt;End Sub&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: Place Text through VBA</title><link>https://communities.bentley.com/thread/240288?ContentTypeID=1</link><pubDate>Wed, 10 Apr 2013 10:41:47 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:0a26fd1b-1b56-4703-aa70-ebebf7ef964d</guid><dc:creator>Rob Golding</dc:creator><description>&lt;p&gt;Hi Jan,&lt;/p&gt;
&lt;p&gt;The Steps listed above are correct apart from number 1.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;em&gt;Text is assigned from somewhere else in the VBA. Will be passed a string&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;Until datapoint is pressed, text is dynamically displayed at cursor. &lt;span style="color:#3366ff;"&gt;(this is so the user can see that the program is wanting the user to place text, plus being able to fit it in the design without accidently overlapping other elements)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;If reset button is pressed, text is erased.&lt;/li&gt;
&lt;li&gt;If datapoint is pressed, text is added into model and the tool is restarted.&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;Probably should have started a new thread, but since its still explaining how to place text in VBA i thought i would leave it. Plus i really didn&amp;#39;t think it would be this involved!&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;Essentially all i want to do was do exactly what the Word Processor / text dialog box does, but instead of having the word processor display and input text, i assign the text through VBA or keyin.&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: Place Text through VBA</title><link>https://communities.bentley.com/thread/240286?ContentTypeID=1</link><pubDate>Wed, 10 Apr 2013 10:28:43 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:57bcbc72-c4d7-473e-9b9e-b39a0dc26cac</guid><dc:creator>Jan Šlegr</dc:creator><description>&lt;p&gt;[quote user=&amp;quot;Rob Golding&amp;quot;]If i add another &amp;quot;ActiveModelReference.AddElement otext&amp;quot; into the Dynamics section[/quote]&lt;/p&gt;
&lt;p&gt;You never can do that. _Dynamics method is called when a cursor is moved, which means it can happen tens times every second. _DataPoint is the best place to add element into a model.&lt;/p&gt;
&lt;p&gt;[quote user=&amp;quot;Rob Golding&amp;quot;]Is there anything from below that could be changed to get the result the client wants?[/quote]&lt;/p&gt;
&lt;p&gt;This thread has become pretty long and it&amp;#39;s hard to find out what your client wants. Can you describe step by step how the tool should work ? Something like (just an example):&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Tool is started, the user is asked to enter text into a dialog.&lt;/li&gt;
&lt;li&gt;Until datapoint is pressed, text is dynamically displayed at cursor.&lt;/li&gt;
&lt;li&gt;If reset button is pressed, text is erased.&lt;/li&gt;
&lt;li&gt;If datapoint is pressed, text is added into model and the tool is restarted.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;What I miss in the information available is a definition how mouse buttons should work.&lt;/p&gt;
&lt;p&gt;With regards,&lt;/p&gt;
&lt;p&gt;&amp;nbsp; Jan&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: Place Text through VBA</title><link>https://communities.bentley.com/thread/240281?ContentTypeID=1</link><pubDate>Wed, 10 Apr 2013 08:23:11 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:7289eb07-75fc-4ed5-a131-f623621295f2</guid><dc:creator>Rob Golding</dc:creator><description>&lt;p&gt;Thanks Jan. I have had a look at the example and it was helpful but still couldn&amp;#39;t give the result the client wants.&lt;/p&gt;
&lt;p&gt;Below is the code that i have pieced together from the example and also from what the guys helped me with above. The exact code below, essentially work the same as before&lt;/p&gt;
&lt;p&gt;If i add another &amp;quot;ActiveModelReference.AddElement otext&amp;quot; into the Dynamics section, then its achieves sort of what i&amp;#39;m after, where the text is placed at the cursor, however everytime the mouse is moved it will place the text... ending up with hundreds of text elements on the design.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Is there anything from below that could be changed to get the result the client wants?&lt;/p&gt;
&lt;p&gt;I have seen a few programs (i think it was part of an MDL) that could do exactly as im after so i assume this is possible?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;hr style="width:90%;" /&gt;
&lt;pre&gt;Implements IPrimitiveCommandEvents&lt;br /&gt;&lt;br /&gt;Private m_strText As String&lt;br /&gt;Private m_atPoints(0 To 1) As Point3d&lt;br /&gt;Private m_nPoints As Integer&lt;br /&gt;&lt;br /&gt;Public Property Let Text(s As String)&lt;br /&gt;  m_strText = s&lt;br /&gt;End Property&lt;br /&gt;&lt;br /&gt;Sub IPrimitiveCommandEvents_Datapoint(Point As Point3d, ByVal oView As View)&lt;/pre&gt;
&lt;pre&gt;&lt;br /&gt;    If m_nPoints = 0 Then&lt;br /&gt;        CommandState.StartDynamics&lt;br /&gt;        m_atPoints(0) = Point&lt;br /&gt;        m_nPoints = 1&lt;br /&gt;        ShowPrompt &amp;quot;Place end point&amp;quot;&lt;br /&gt;    ElseIf m_nPoints = 1 Then&lt;br /&gt;        m_atPoints(1) = Point&lt;br /&gt;        Dim otext As TextElement&lt;br /&gt;        Set otext = CreateTextElement1(Nothing, m_strText, Point, Matrix3dIdentity)&lt;br /&gt;        ActiveModelReference.AddElement otext&lt;br /&gt;        otext.Redraw msdDrawingModeNormal&lt;br /&gt;        m_atPoints(0) = m_atPoints(1)&lt;br /&gt;    End If&lt;br /&gt;&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Private Sub IPrimitiveCommandEvents_Dynamics(Point As Point3d, ByVal View As View, ByVal DrawMode As MsdDrawingMode)&lt;br /&gt;&lt;br /&gt;    If m_nPoints = 1 Then&lt;br /&gt;        m_atPoints(1) = Point&lt;br /&gt;        Dim otext As TextElement&lt;br /&gt;        Set otext = CreateTextElement1(Nothing, m_strText, Point, Matrix3dIdentity)&lt;br /&gt;        otext.Redraw msdDrawingModeNormal&lt;br /&gt;    End If&lt;br /&gt;End Sub&lt;/pre&gt;
&lt;pre&gt;&lt;br /&gt;Private Sub IPrimitiveCommandEvents_Keyin(ByVal Keyin As String)&lt;/pre&gt;
&lt;pre&gt;End Sub&lt;/pre&gt;
&lt;pre&gt;&lt;br /&gt;Private Sub IPrimitiveCommandEvents_Reset()&lt;br /&gt;    CommandState.StartPrimitive Me&lt;br /&gt;    m_nPoints = 0&lt;br /&gt;End Sub&lt;/pre&gt;
&lt;pre&gt;&lt;br /&gt;Private Sub IPrimitiveCommandEvents_Start()&lt;br /&gt;    ShowPrompt &amp;quot;Select insertion point for text&amp;quot;&lt;br /&gt;End Sub&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: Place Text through VBA</title><link>https://communities.bentley.com/thread/240050?ContentTypeID=1</link><pubDate>Mon, 08 Apr 2013 13:28:53 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:1cd69b46-0aa1-4adc-b2db-02614f896b06</guid><dc:creator>Jan Šlegr</dc:creator><description>&lt;p&gt;Hi Rob,&lt;/p&gt;
&lt;p&gt;you can display dynamic elements when Primitive Command is active. The right place to do it is Dynamics methods in IPrimitiveCommandEvents, because this method is called everytime the cursor is moved. &lt;/p&gt;
&lt;p&gt;You can check for example Line Element Creation Command example in MicroStation VBA help to see how to do it.&lt;/p&gt;
&lt;p&gt;If there is no dynamic, Transient Elements can be used to display elements that don&amp;#39;t exist in design file.&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: Place Text through VBA</title><link>https://communities.bentley.com/thread/240048?ContentTypeID=1</link><pubDate>Mon, 08 Apr 2013 13:10:54 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:f7309de6-7d70-4f2a-aa85-271ec1087d6a</guid><dc:creator>Rob Golding</dc:creator><description>&lt;p&gt;Just a bit further to this... the client has asked if its possible to show a preview of the text on the screen (i personally think its not needed but hey they pay the bills so least i can do is ask)&lt;/p&gt;
&lt;p&gt;In the above, I know that VBA doesn&amp;#39;t actually create the text element until the datapoint is clicked, so i&amp;#39;m not sure if this is possible.&lt;/p&gt;
&lt;p&gt;They basically want to be able to see where the text is going to be placed, so much like the text already predefined at the cursor just waiting for a insertion point.&lt;/p&gt;
&lt;p&gt;Any ideas?&lt;/p&gt;
&lt;p&gt;Thanks again!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: Place Text through VBA</title><link>https://communities.bentley.com/thread/239432?ContentTypeID=1</link><pubDate>Tue, 02 Apr 2013 13:24:34 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:7158ea98-6cd4-4878-a8fb-b4265b32dd6d</guid><dc:creator>Rob Golding</dc:creator><description>&lt;p&gt;You guys are absolute legends!&lt;/p&gt;
&lt;p&gt;All working. Many thanks for helping out!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: Place Text through VBA</title><link>https://communities.bentley.com/thread/239430?ContentTypeID=1</link><pubDate>Tue, 02 Apr 2013 13:17:47 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:a50ab885-7231-458d-8ca5-1f9c5ee1e75d</guid><dc:creator>stefan_bernsdorf</dc:creator><description>&lt;p&gt;You must have Procedures for all Procedures defined in your Interface.&lt;/p&gt;
&lt;p&gt;(Just click them all once in our VBA IDE.)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: Place Text through VBA</title><link>https://communities.bentley.com/thread/239429?ContentTypeID=1</link><pubDate>Tue, 02 Apr 2013 13:16:26 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:401330c3-e654-4c29-8273-d9690d681aef</guid><dc:creator>Jon Summers</dc:creator><description>&lt;p&gt;[quote user=&amp;quot;Rob Golding&amp;quot;]Object module needs to implement &amp;#39;Keyin&amp;#39; for interface &amp;#39;IPrimitiveCommandEvents&amp;#39;[/quote]&lt;/p&gt;
&lt;p&gt;In VB/VBA, a class that Implements an &lt;span style="font-family:courier new,courier;"&gt;Interface&lt;/span&gt; must have all the subroutines of that &lt;span style="font-family:courier new,courier;"&gt;Interface&lt;/span&gt;, even when they do nothing.&amp;nbsp; In other words, you must write all the subroutines required by &lt;span style="font-family:courier new,courier;"&gt;IPrimitiveCommandEvents&lt;/span&gt;.&amp;nbsp; Fortunately, the IDE provides some assistance:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Top-left is a combobox having a list of classes and interfaces in your current project&lt;ol&gt;
&lt;li&gt;Choose &lt;span style="font-family:courier new,courier;"&gt;IPrimitiveCommandEvents&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;/li&gt;
&lt;li&gt;Top-right is a list of procedures for the current class or interface&lt;ol&gt;
&lt;li&gt;As you select each procedure, VBA writes a skeleton for that procedure&lt;/li&gt;
&lt;li&gt;Repeat and rinse for each procedure&lt;/li&gt;
&lt;/ol&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description><enclosure url="https://communities.bentley.com/cfs-file/__key/telligent-evolution-components-attachments/00-343173-01-00-00-23-94-29/IPrimitiveCommandEvents_2D00_IDE.png" length="10277" type="image/png" /></item><item><title>Re: Place Text through VBA</title><link>https://communities.bentley.com/thread/239425?ContentTypeID=1</link><pubDate>Tue, 02 Apr 2013 13:05:55 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:65589095-1054-4b7f-b19a-b5d43a8c58fd</guid><dc:creator>Rob Golding</dc:creator><description>&lt;p&gt;Happier :)&lt;/p&gt;
&lt;p&gt;---------------------------&lt;/p&gt;
&lt;p&gt;Microsoft Visual Basic&lt;/p&gt;
&lt;p&gt;---------------------------&lt;/p&gt;
&lt;p&gt;Compile error:&lt;/p&gt;
&lt;p&gt;Object module needs to implement &amp;#39;Keyin&amp;#39; for interface &amp;#39;IPrimitiveCommandEvents&amp;#39;&lt;/p&gt;
&lt;p&gt;has highlighted&lt;/p&gt;
&lt;p&gt;Implements IPrimitiveCommandEvents&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: Place Text through VBA</title><link>https://communities.bentley.com/thread/239423?ContentTypeID=1</link><pubDate>Tue, 02 Apr 2013 13:00:22 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:4047f94d-212f-4a8a-851c-9c1c402e0000</guid><dc:creator>Jon Summers</dc:creator><description>&lt;p&gt;[quote user=&amp;quot;Rob Golding&amp;quot;]Sub IPrimitiveCommandEvents_Datapoint(point As Point3d, oView As View)[/quote]&lt;/p&gt;
&lt;p&gt;The exact signature is&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:courier new,courier;"&gt;Sub IPrimitiveCommandEvents_Datapoint(point As Point3d, &lt;strong&gt;&lt;span style="color:#008000;"&gt;ByVal&lt;/span&gt;&lt;/strong&gt; oView As View)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Is the compiler happier with that?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: Place Text through VBA</title><link>https://communities.bentley.com/thread/239421?ContentTypeID=1</link><pubDate>Tue, 02 Apr 2013 12:51:10 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:9af76887-9384-426c-a3e6-0be3ed2135bd</guid><dc:creator>Rob Golding</dc:creator><description>&lt;p&gt;Thanks Jon, much appreciated. I&amp;#39;m still a relative newbie to all this. Its a hell of a learning curve!&lt;/p&gt;
&lt;p&gt;Its skipped over that part but now it comes up with another message.&lt;/p&gt;
&lt;p&gt;Compile error:&lt;/p&gt;
&lt;p&gt;Procedure declaration does not match description of event or procedure having the same name&lt;/p&gt;
&lt;p&gt;Its highlighted the ...&lt;/p&gt;
&lt;p&gt;Sub IPrimitiveCommandEvents_Datapoint(point As Point3d, oView As View)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: Place Text through VBA</title><link>https://communities.bentley.com/thread/239418?ContentTypeID=1</link><pubDate>Tue, 02 Apr 2013 12:47:54 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:7014cc90-2b23-4397-8fe7-76c19e8e6a78</guid><dc:creator>Jon Summers</dc:creator><description>&lt;p&gt;[quote user=&amp;quot;stefan_bernsdorf&amp;quot;]Your Property needs a Getter![/quote]&lt;/p&gt;
&lt;p&gt;A VB/VBA class property lets you assign data to an object or get data from an object.&amp;nbsp; You can write either or both properties, although it&amp;#39;s usual to write both.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A class having only a &lt;span style="font-family:courier new,courier;"&gt;Set&lt;/span&gt; or &lt;span style="font-family:courier new,courier;"&gt;Let&lt;/span&gt; property is write-only&lt;/li&gt;
&lt;li&gt;A class having only a &lt;span style="font-family:courier new,courier;"&gt;Get&lt;/span&gt; property is read-only&lt;/li&gt;
&lt;li&gt;A class having both &lt;span style="font-family:courier new,courier;"&gt;Get&lt;/span&gt; and &lt;span style="font-family:courier new,courier;"&gt;Set&lt;/span&gt; or &lt;span style="font-family:courier new,courier;"&gt;Let&lt;/span&gt; properties is read-write&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: Place Text through VBA</title><link>https://communities.bentley.com/thread/239416?ContentTypeID=1</link><pubDate>Tue, 02 Apr 2013 12:39:26 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:7be42424-c506-405c-a6b6-c737c58b9d54</guid><dc:creator>Jon Summers</dc:creator><description>&lt;h4&gt;&lt;span style="color:#008000;"&gt;Syntax of Class Properties&lt;/span&gt;&lt;/h4&gt;
&lt;p&gt;When you write a class property with VB/VBA...&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;use the &lt;span style="font-family:courier new,courier;"&gt;Set&lt;/span&gt; keyword when assigning an object&lt;/li&gt;
&lt;li&gt;use the &lt;span style="font-family:courier new,courier;"&gt;Let&lt;/span&gt; keyword when assigning plain old data (POD), such as a number or string&lt;/li&gt;
&lt;li&gt;use the &lt;span style="font-family:courier new,courier;"&gt;Get&lt;/span&gt; keyword to extract data from the class&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In your screenshot, the incomprehensible error message is trying to tell you to use &lt;span style="font-family:courier new,courier;"&gt;Let&lt;/span&gt; rather tha &lt;span style="font-family:courier new,courier;"&gt;Set&lt;/span&gt; in your &lt;span style="font-family:courier new,courier;"&gt;Text&lt;/span&gt; property.&amp;nbsp; Try this instead:&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:courier new,courier;"&gt;Public Property &lt;strong&gt;&lt;span style="color:#008000;"&gt;Let&lt;/span&gt;&lt;/strong&gt; Text (s As String)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new,courier;"&gt;&amp;nbsp; m_strText = s&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new,courier;"&gt;End Property&lt;/span&gt;&lt;/p&gt;
&lt;h4&gt;&lt;span style="color:#008000;"&gt;Apologies&lt;/span&gt;&lt;/h4&gt;
&lt;pre&gt;&lt;/pre&gt;
&lt;p&gt;[quote user=&amp;quot;Rob Golding&amp;quot;]What have I done wrong?[/quote]&lt;/p&gt;
&lt;p&gt;Nothing! That was my fault for writing the wrong keyword in my example below.&amp;nbsp; I&amp;#39;m always forgetting to use &lt;span style="font-family:courier new,courier;"&gt;Let&lt;/span&gt; for PODs.&lt;span style="font-family:courier new,courier;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: Place Text through VBA</title><link>https://communities.bentley.com/thread/239412?ContentTypeID=1</link><pubDate>Tue, 02 Apr 2013 11:56:32 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:aa501ad5-b15f-4408-9b11-6c83a86f6a3c</guid><dc:creator>stefan_bernsdorf</dc:creator><description>&lt;p&gt;Your Property needs a Getter! Google your error text, you will find an answer.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: Place Text through VBA</title><link>https://communities.bentley.com/thread/239411?ContentTypeID=1</link><pubDate>Tue, 02 Apr 2013 11:44:19 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:9b9ad947-837b-45bf-8334-f62c02e99bf9</guid><dc:creator>Rob Golding</dc:creator><description>&lt;p&gt;I understand the highlighted part is the error but not too sure why its appearing.&lt;/p&gt;
&lt;p&gt;I have attached the picture rather than embed it.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks for the replies guys.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description><enclosure url="https://communities.bentley.com/cfs-file/__key/telligent-evolution-components-attachments/00-343173-01-00-00-23-94-11/error.JPG" length="78220" type="image/jpeg" /></item><item><title>Re: Place Text through VBA</title><link>https://communities.bentley.com/thread/239406?ContentTypeID=1</link><pubDate>Tue, 02 Apr 2013 11:07:22 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:cf598a71-a17f-4860-a08a-f9f4ae289dd4</guid><dc:creator>stefan_bernsdorf</dc:creator><description>&lt;p&gt;See the highlighted portion of your code? Thats the error. Unfortunately the Screenshot is too small, could not read it.&lt;/p&gt;
&lt;p&gt;But I can see it is not the part you copied into your mail.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: Place Text through VBA</title><link>https://communities.bentley.com/thread/239405?ContentTypeID=1</link><pubDate>Tue, 02 Apr 2013 10:45:09 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:9e453333-5b7c-478b-bd73-cb5c70cb80fa</guid><dc:creator>Rob Golding</dc:creator><description>&lt;p&gt;Thanks Jon,&lt;/p&gt;
&lt;p&gt;I haven&amp;#39;t been able to get that to work unfortunatley.&lt;/p&gt;
&lt;p&gt;I have done as above...&lt;/p&gt;
&lt;p&gt;-Created a Class Module called &amp;quot;clsGolding&amp;quot; which has the following in it... But when run the below error appears.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://communities.bentley.com/resized-image.ashx/__size/550x0/__key/CommunityServer-Discussions-Components-Files/343173/0602.error.JPG" border="0" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;pre&gt;My form has a button that simply is this&lt;/pre&gt;
&lt;pre&gt;&lt;span class="Apple-tab-span" style="white-space:pre;"&gt; &lt;/span&gt;PlaceTextInteractive (&amp;quot;testing&amp;quot;)&lt;/pre&gt;
&lt;pre&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;/pre&gt;
&lt;pre&gt;Which controls this&lt;/pre&gt;
&lt;pre&gt;&lt;/pre&gt;
&lt;pre&gt;Sub PlaceTextInteractive(s As String)&lt;br /&gt;  Dim oTextPlacer As New clsGolding&lt;br /&gt;  oTextPlacer.Text = s&lt;br /&gt;  CommandState.StartPrimitive oTextPlacer&lt;br /&gt;End Sub&lt;/pre&gt;
&lt;pre&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;/pre&gt;
&lt;pre&gt;What have I done wrong?&lt;/pre&gt;
&lt;pre&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: Place Text through VBA</title><link>https://communities.bentley.com/thread/238996?ContentTypeID=1</link><pubDate>Thu, 28 Mar 2013 12:26:03 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:0021fcc9-dba3-480d-a681-2b248adae5e0</guid><dc:creator>Jon Summers</dc:creator><description>&lt;p&gt;[quote user=&amp;quot;Rob Golding&amp;quot;]The only thing is that i would like the user to place the text where they would like, is there a way Ii can put the new text element to the cursor and have the user select the point?[/quote]&lt;/p&gt;
&lt;p&gt;Write a class that&lt;span style="font-family:courier new,courier;"&gt; Implements IPrimitiveCommandEvents&lt;/span&gt;.&amp;nbsp; Read about&lt;em&gt; Interface Oriented Programming&lt;/em&gt; in VBA help. &amp;nbsp;Start that class from your form and pass it the string to be created.&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:courier new,courier;"&gt;Sub PlaceTextInteractive (s As String)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new,courier;"&gt;&amp;nbsp; Dim oTextPlacer As New clsGolding&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new,courier;"&gt;&amp;nbsp; oTextPlacer.Text = s&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new,courier;"&gt;&amp;nbsp; CommandState.StartPrimitive oTextPlacer &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new,courier;"&gt;End Sub&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Create a class module named &lt;span style="font-family:courier new,courier;"&gt;clsGolding&lt;/span&gt;.&amp;nbsp; Put the following in that class...&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:courier new,courier;"&gt;Implements IPrimitiveCommandEvents&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:courier new,courier;"&gt;Private m_strText As String&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:courier new,courier;"&gt;&lt;span style="font-family:courier new,courier;"&gt;[Edit] &amp;#39; wrong: Public Property &lt;span style="color:#ff0000;"&gt;Set&lt;/span&gt; Text (s As String)&lt;/span&gt;&lt;span style="font-family:courier new,courier;"&gt;&lt;br /&gt;Public Property Let Text (s As String)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new,courier;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new,courier;"&gt;&lt;/span&gt;&amp;nbsp; m_strText = s&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new,courier;"&gt;End Property&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:courier new,courier;color:#008000;"&gt;&amp;#39;&amp;nbsp; Add all the subroutines required by IPrimitiveCommandEvents&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:courier new,courier;"&gt;Sub IPrimitiveCommandEvents_Datapoint (point As Point3d, oView As View)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new,courier;"&gt;&amp;nbsp; Dim oText As TextElement&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new,courier;"&gt;&amp;nbsp; Set oText = CreateTextElement1 (Nothing, m_strText, point, Matrix3dIdentity)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new,courier;"&gt;&amp;nbsp; ActiveModelReference.AddElement oText&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new,courier;"&gt;End Sub&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: Place Text through VBA</title><link>https://communities.bentley.com/thread/238971?ContentTypeID=1</link><pubDate>Thu, 28 Mar 2013 07:50:52 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:b7a3dbc9-060e-4358-91f7-90a0fbf575d3</guid><dc:creator>Rob Golding</dc:creator><description>&lt;p&gt;Thanks for the replies. Has basically got what i wanted.&lt;/p&gt;
&lt;p&gt;The only thing is that i would like the user to place the text where they would like, is there a way i can put the new text element to the cursor and have the user select the point? rather than define the point?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: Place Text through VBA</title><link>https://communities.bentley.com/thread/238539?ContentTypeID=1</link><pubDate>Mon, 25 Mar 2013 12:59:52 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:d05dda70-e6d7-487f-a9d8-8daea44e5e61</guid><dc:creator>Jon Summers</dc:creator><description>&lt;p&gt;[quote user=&amp;quot;Rob Golding&amp;quot;] &lt;span style="font-family:courier new,courier;"&gt;CadInputQueue.SendKeyin &amp;quot;place text&amp;quot;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new,courier;"&gt; CadInputQueue.SendKeyin sText&lt;/span&gt;[/quote]&lt;/p&gt;
&lt;p&gt;In general, if you queue a user key-in using VBA then the result is the same as if you performed that task manually.&amp;nbsp; In other words, MicroStation can&amp;#39;t distinguish between you typing &lt;span style="font-family:courier new,courier;"&gt;place dialogtext icon&lt;/span&gt; and VBA queueing &lt;span style="font-family:courier new,courier;"&gt;place dialogtext icon&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;If a key-in causes MicroStation to pop a dialog, then it will pop that dialog.&lt;/p&gt;
&lt;p&gt;If you want to avoid the consequents of a user key-in, then use VBA to create objects directly, in the way that others have suggested.&amp;nbsp; Search VBA help for examples.&amp;nbsp; Searching for &lt;span style="font-family:courier new,courier;"&gt;CreateTextElement1&lt;/span&gt; reveals an example under topic &lt;em&gt;Elements and Levels&lt;/em&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>