<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: VBA string replace mtext in VBA Forum</title>
    <link>https://forums.autodesk.com/t5/vba-forum/vba-string-replace-mtext/m-p/6589557#M8577</link>
    <description>&lt;P&gt;Sure, its possible, but have you tried the FIND command?&lt;/P&gt;</description>
    <pubDate>Wed, 28 Sep 2016 14:30:07 GMT</pubDate>
    <dc:creator>Ed__Jobe</dc:creator>
    <dc:date>2016-09-28T14:30:07Z</dc:date>
    <item>
      <title>VBA string replace mtext</title>
      <link>https://forums.autodesk.com/t5/vba-forum/vba-string-replace-mtext/m-p/6589406#M8576</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I have a autocad 2d drawing with a lot of mtext. I have to change all instances of ":" to "-". Doing this manually would take a long time, so I thought of doing it with VBA.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I'm not asking for a full code, but some input on wether this is possible or not? All I have found about this on the internet is about making a new mtext, not editing existing mtexts.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, my pseudo-code I imagine is something like this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Loop all objects&lt;/P&gt;&lt;P&gt;if(type=mtext)&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;mtext.text = str_replace(":","-",mtext.text)&lt;/P&gt;&lt;P&gt;end if&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;This is first time vba in acad. Have done some before in excel and access..&lt;BR /&gt;&lt;BR /&gt;Thanks in advance&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Sep 2016 13:32:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/vba-string-replace-mtext/m-p/6589406#M8576</guid>
      <dc:creator>jorgen.fidjeland</dc:creator>
      <dc:date>2016-09-28T13:32:19Z</dc:date>
    </item>
    <item>
      <title>Re: VBA string replace mtext</title>
      <link>https://forums.autodesk.com/t5/vba-forum/vba-string-replace-mtext/m-p/6589557#M8577</link>
      <description>&lt;P&gt;Sure, its possible, but have you tried the FIND command?&lt;/P&gt;</description>
      <pubDate>Wed, 28 Sep 2016 14:30:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/vba-string-replace-mtext/m-p/6589557#M8577</guid>
      <dc:creator>Ed__Jobe</dc:creator>
      <dc:date>2016-09-28T14:30:07Z</dc:date>
    </item>
    <item>
      <title>Re: VBA string replace mtext</title>
      <link>https://forums.autodesk.com/t5/vba-forum/vba-string-replace-mtext/m-p/8102045#M8578</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I have tried to get the MText string of a Mtext of AutoCAD 2016 using VBA. Here the case is, I could able to get "Text" but not MText. Kindly anyone help me. I'm bit new to AutoCAD customization.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Set oSset = .Add("$MTexts$").&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dim mode As Integer&lt;BR /&gt;Dim corner1(0 To 2) As Double&lt;BR /&gt;Dim corner2(0 To 2) As Double&lt;BR /&gt;&lt;BR /&gt;mode = acSelectionSetCrossing&lt;BR /&gt;corner1(0) = 3.1325: corner1(1) = 2.1875: corner1(2) = 0 ''2 3/16&lt;BR /&gt;corner2(0) = 3.6315: corner2(1) = 3.5625: corner2(2) = 0&lt;BR /&gt;oSset.Select mode, corner1, corner2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;please help me...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Naresh Kalyan&lt;/P&gt;</description>
      <pubDate>Sat, 30 Jun 2018 07:17:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/vba-string-replace-mtext/m-p/8102045#M8578</guid>
      <dc:creator>naresh_kalyan</dc:creator>
      <dc:date>2018-06-30T07:17:28Z</dc:date>
    </item>
    <item>
      <title>Re: VBA string replace mtext</title>
      <link>https://forums.autodesk.com/t5/vba-forum/vba-string-replace-mtext/m-p/8102236#M8579</link>
      <description>&lt;P&gt;Well, your code is not relevant to why you was able to get Text, but not MText. It just selects anything inside/crossed by a window. Are you sure there are MText, or any entity for that matter, being selected in the SelectionSet? Since you did not set selecting filter, it is not guaranteed that only MText entities are selected. So, you need to find out if an entity in the SelectionSet is the type of entity you target:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;...&lt;/P&gt;
&lt;P&gt;'' Assume the selection does select some entities&lt;/P&gt;
&lt;P&gt;'' which may or may not be all MText entities&lt;/P&gt;
&lt;P&gt;OSset.Select mode, corner1, corner2&lt;/P&gt;
&lt;P&gt;Dim ent As AcadEntity&lt;/P&gt;
&lt;P&gt;Dim mtxt As AcadMText&lt;/P&gt;
&lt;P&gt;Dim count As Integer&lt;/P&gt;
&lt;P&gt;For Each ent In oSset&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; If TypeOf ent Is AcadMText Then&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Set mtxt=ent&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; HandleMText mtxt&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; count = count +1&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; End If&lt;/P&gt;
&lt;P&gt;Next&lt;/P&gt;
&lt;P&gt;MsgBox count &amp;amp; "MText entities have been handled."&lt;/P&gt;
&lt;P&gt;....&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Private Sub HandleMText(mtext As AcadMText)&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; '' Do whatever with the MText&lt;/P&gt;
&lt;P&gt;End Sub&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 30 Jun 2018 12:48:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/vba-string-replace-mtext/m-p/8102236#M8579</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2018-06-30T12:48:32Z</dc:date>
    </item>
    <item>
      <title>Re: VBA string replace mtext</title>
      <link>https://forums.autodesk.com/t5/vba-forum/vba-string-replace-mtext/m-p/8106130#M8580</link>
      <description>&lt;P&gt;Thank you for the help with in a short span... it works perfectly..&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you Norman...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Naresh Kalyan&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jul 2018 06:26:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/vba-string-replace-mtext/m-p/8106130#M8580</guid>
      <dc:creator>naresh_kalyan</dc:creator>
      <dc:date>2018-07-03T06:26:48Z</dc:date>
    </item>
    <item>
      <title>Re: VBA string replace mtext</title>
      <link>https://forums.autodesk.com/t5/vba-forum/vba-string-replace-mtext/m-p/8597054#M8581</link>
      <description>&lt;P&gt;Hi Naresh,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This Mahamuni from Dombivali Mumbai sudhanvammahamuni@gmail.com. Please go through following link, hope this will be helpful for you......&lt;/P&gt;
&lt;P&gt;&lt;A href="https://myengineeringworld.net/2014/03/add-text-in-autocad-using-excel-vba.html" target="_blank"&gt;https://myengineeringworld.net/2014/03/add-text-in-autocad-using-excel-vba.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;This program is developed by Mr. Christos from Greece. He is very helpful and if he know the solution he will defiantly help you,&amp;nbsp; you will find his contact details on his website.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Mahamuni&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4096526"&gt;@jorgen.fidjeland&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So I have a autocad 2d drawing with a lot of mtext. I have to change all instances of ":" to "-". Doing this manually would take a long time, so I thought of doing it with VBA.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;I'm not asking for a full code, but some input on wether this is possible or not? All I have found about this on the internet is about making a new mtext, not editing existing mtexts.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, my pseudo-code I imagine is something like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Loop all objects&lt;/P&gt;
&lt;P&gt;if(type=mtext)&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;mtext.text = str_replace(":","-",mtext.text)&lt;/P&gt;
&lt;P&gt;end if&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;This is first time vba in acad. Have done some before in excel and access..&lt;BR /&gt;&lt;BR /&gt;Thanks in advance&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4096526"&gt;@jorgen.fidjeland&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So I have a autocad 2d drawing with a lot of mtext. I have to change all instances of ":" to "-". Doing this manually would take a long time, so I thought of doing it with VBA.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;I'm not asking for a full code, but some input on wether this is possible or not? All I have found about this on the internet is about making a new mtext, not editing existing mtexts.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, my pseudo-code I imagine is something like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Loop all objects&lt;/P&gt;
&lt;P&gt;if(type=mtext)&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;mtext.text = str_replace(":","-",mtext.text)&lt;/P&gt;
&lt;P&gt;end if&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;This is first time vba in acad. Have done some before in excel and access..&lt;BR /&gt;&lt;BR /&gt;Thanks in advance&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Feb 2019 20:30:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/vba-string-replace-mtext/m-p/8597054#M8581</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-02-14T20:30:01Z</dc:date>
    </item>
  </channel>
</rss>

