<?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: find and replace text for active sheet in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/find-and-replace-text-for-active-sheet/m-p/12499709#M34084</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/12855005"&gt;@brianM328K&lt;/a&gt;.&amp;nbsp; I am not sure what you mean.&amp;nbsp; Are you saying that you would like to pause the process and highlight each object just before it edits them, and ask the user if they want this item to be edited?&amp;nbsp; Are you wanting that after all editing has been done, that it will highlight all the stuff that was edited?&amp;nbsp; I am not sure that would be possible.&amp;nbsp; There is a &lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=Document_CreateHighlightSet" target="_blank" rel="noopener"&gt;Document.CreateHighlightSet&lt;/A&gt; method that will create a &lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=GUID-HighlightSet" target="_blank" rel="noopener"&gt;HighlightSet&lt;/A&gt; object, but using them can be finicky.&amp;nbsp; Some types of objects can be added to one of these, and some can not be added to them.&amp;nbsp; If some stuff is inside of a sketch, and some stuff is not, then they may not be able to coexist as visibly highlighted at the same time.&amp;nbsp; The sketch may need to be in edit mode before some stuff within it can be actively highlighted, and may need to remain in edit mode when reviewed by the user.&amp;nbsp; Other stuff that is outside of the sketch may not be available when in edit mode of a specific sketch also.&amp;nbsp; Plus, the highlight effect can sometimes only last momentarily after the code has finished, because sometimes it can easily be interrupted, but other times it stays active pretty well.&lt;/P&gt;</description>
    <pubDate>Tue, 16 Jan 2024 14:54:35 GMT</pubDate>
    <dc:creator>WCrihfield</dc:creator>
    <dc:date>2024-01-16T14:54:35Z</dc:date>
    <item>
      <title>find and replace text for active sheet</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/find-and-replace-text-for-active-sheet/m-p/11362214#M34081</link>
      <description>&lt;P&gt;Can someone help me modify this code to only search active sheet please&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;Sub&lt;/SPAN&gt; &lt;SPAN&gt;main&lt;/SPAN&gt;
        &lt;SPAN&gt;oDoc&lt;/SPAN&gt; = &lt;SPAN&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Document&lt;/SPAN&gt;
        &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oSheets&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Sheets&lt;/SPAN&gt;
        &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oSheet&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Sheet&lt;/SPAN&gt;
        &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oGeneralNotes&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;GeneralNotes&lt;/SPAN&gt;
        &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oGeneralNote&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;GeneralNote&lt;/SPAN&gt;
        &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oSymbol&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;SketchedSymbol&lt;/SPAN&gt;
        &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oSymbols&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;SketchedSymbols&lt;/SPAN&gt;
        &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oTitleBlock&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;TitleBlock&lt;/SPAN&gt;
        &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oTextBox&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;TextBox&lt;/SPAN&gt;

        &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;ooTXT2Find&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt;
        &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oNewTXT&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt;

        &lt;SPAN&gt;'get user input&lt;/SPAN&gt;
        &lt;SPAN&gt;oTXT2Find&lt;/SPAN&gt; = &lt;SPAN&gt;InputBox&lt;/SPAN&gt;(&lt;SPAN&gt;"Enter Text To Find:"&lt;/SPAN&gt;, &lt;SPAN&gt;"iLogic"&lt;/SPAN&gt;, &lt;SPAN&gt;"XXX"&lt;/SPAN&gt;)
        &lt;SPAN&gt;'look for blank value&lt;/SPAN&gt;
        &lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;oTXT2Find&lt;/SPAN&gt; = &lt;SPAN&gt;""&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt;
               &lt;SPAN&gt;Return&lt;/SPAN&gt; &lt;SPAN&gt;'exit rule&lt;/SPAN&gt;
        &lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;

        &lt;SPAN&gt;oNewTXT&lt;/SPAN&gt; = &lt;SPAN&gt;InputBox&lt;/SPAN&gt;(&lt;SPAN&gt;"Enter Text To Replace   '"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;oTXT2Find&lt;/SPAN&gt; _
        &amp;amp; &lt;SPAN&gt;"'  with."&lt;/SPAN&gt;, &lt;SPAN&gt;"iLogic"&lt;/SPAN&gt;, &lt;SPAN&gt;"ZZZ"&lt;/SPAN&gt;)
        &lt;SPAN&gt;'look for blank value&lt;/SPAN&gt;
        &lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;oNewTXT&lt;/SPAN&gt; = &lt;SPAN&gt;""&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt;
               &lt;SPAN&gt;Return&lt;/SPAN&gt; &lt;SPAN&gt;'exit rule&lt;/SPAN&gt;
        &lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;

        &lt;SPAN&gt;oSheets&lt;/SPAN&gt; = &lt;SPAN&gt;oDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Sheets&lt;/SPAN&gt;
        &lt;SPAN&gt;For&lt;/SPAN&gt; &lt;SPAN&gt;Each&lt;/SPAN&gt; &lt;SPAN&gt;oSheet&lt;/SPAN&gt; &lt;SPAN&gt;In&lt;/SPAN&gt; &lt;SPAN&gt;oSheets&lt;/SPAN&gt;

               &lt;SPAN&gt;'handle errors&lt;/SPAN&gt;
               &lt;SPAN&gt;On&lt;/SPAN&gt; &lt;SPAN&gt;Error&lt;/SPAN&gt; &lt;SPAN&gt;Resume&lt;/SPAN&gt; &lt;SPAN&gt;Next&lt;/SPAN&gt;

               &lt;SPAN&gt;'look at General Notes&lt;/SPAN&gt;
               &lt;SPAN&gt;oGeneralNotes&lt;/SPAN&gt; = &lt;SPAN&gt;oSheet&lt;/SPAN&gt;.&lt;SPAN&gt;DrawingNotes&lt;/SPAN&gt;.&lt;SPAN&gt;GeneralNotes&lt;/SPAN&gt;
               &lt;SPAN&gt;For&lt;/SPAN&gt; &lt;SPAN&gt;Each&lt;/SPAN&gt; &lt;SPAN&gt;oGeneralNote&lt;/SPAN&gt; &lt;SPAN&gt;In&lt;/SPAN&gt; &lt;SPAN&gt;oGeneralNotes&lt;/SPAN&gt;
                       &lt;SPAN&gt;oText&lt;/SPAN&gt; = &lt;SPAN&gt;oGeneralNote&lt;/SPAN&gt;.&lt;SPAN&gt;FormattedText&lt;/SPAN&gt;
                       &lt;SPAN&gt;oText&lt;/SPAN&gt; = &lt;SPAN&gt;ReplaceText&lt;/SPAN&gt;(&lt;SPAN&gt;oText&lt;/SPAN&gt;, &lt;SPAN&gt;oTXT2Find&lt;/SPAN&gt;, &lt;SPAN&gt;oNewTXT&lt;/SPAN&gt;)
                       &lt;SPAN&gt;oGeneralNote&lt;/SPAN&gt;.&lt;SPAN&gt;FormattedText&lt;/SPAN&gt; = &lt;SPAN&gt;oText&lt;/SPAN&gt;
               &lt;SPAN&gt;Next&lt;/SPAN&gt;

               &lt;SPAN&gt;'look at leader notes &lt;/SPAN&gt;
               &lt;SPAN&gt;oLeaderNotes&lt;/SPAN&gt; = &lt;SPAN&gt;oSheet&lt;/SPAN&gt;.&lt;SPAN&gt;DrawingNotes&lt;/SPAN&gt;.&lt;SPAN&gt;LeaderNotes&lt;/SPAN&gt;
               &lt;SPAN&gt;For&lt;/SPAN&gt; &lt;SPAN&gt;Each&lt;/SPAN&gt; &lt;SPAN&gt;oLeaderNote&lt;/SPAN&gt; &lt;SPAN&gt;In&lt;/SPAN&gt; &lt;SPAN&gt;oLeaderNotes&lt;/SPAN&gt;
                       &lt;SPAN&gt;oText&lt;/SPAN&gt; = &lt;SPAN&gt;oLeaderNote&lt;/SPAN&gt;.&lt;SPAN&gt;FormattedText&lt;/SPAN&gt;
                       &lt;SPAN&gt;oText&lt;/SPAN&gt; = &lt;SPAN&gt;ReplaceText&lt;/SPAN&gt;(&lt;SPAN&gt;oText&lt;/SPAN&gt;, &lt;SPAN&gt;oTXT2Find&lt;/SPAN&gt;, &lt;SPAN&gt;oNewTXT&lt;/SPAN&gt;)
                       &lt;SPAN&gt;oLeaderNote&lt;/SPAN&gt;.&lt;SPAN&gt;FormattedText&lt;/SPAN&gt; = &lt;SPAN&gt;oText&lt;/SPAN&gt;
               &lt;SPAN&gt;Next&lt;/SPAN&gt;

               &lt;SPAN&gt;'look at title blocks&lt;/SPAN&gt;
               &lt;SPAN&gt;oTitleBlock&lt;/SPAN&gt; = &lt;SPAN&gt;oSheet&lt;/SPAN&gt;.&lt;SPAN&gt;TitleBlock&lt;/SPAN&gt;
               &lt;SPAN&gt;For&lt;/SPAN&gt; &lt;SPAN&gt;Each&lt;/SPAN&gt; &lt;SPAN&gt;oTextBox&lt;/SPAN&gt; &lt;SPAN&gt;In&lt;/SPAN&gt; &lt;SPAN&gt;oTitleBlock&lt;/SPAN&gt;.&lt;SPAN&gt;Definition&lt;/SPAN&gt;.&lt;SPAN&gt;Sketch&lt;/SPAN&gt;.&lt;SPAN&gt;TextBoxes&lt;/SPAN&gt;
                       &lt;SPAN&gt;oText&lt;/SPAN&gt; = &lt;SPAN&gt;oTitleBlock&lt;/SPAN&gt;.&lt;SPAN&gt;GetResultText&lt;/SPAN&gt;(&lt;SPAN&gt;oTextBox&lt;/SPAN&gt;)
                       &lt;SPAN&gt;oText&lt;/SPAN&gt; = &lt;SPAN&gt;ReplaceText&lt;/SPAN&gt;(&lt;SPAN&gt;oText&lt;/SPAN&gt;, &lt;SPAN&gt;oTXT2Find&lt;/SPAN&gt;, &lt;SPAN&gt;oNewTXT&lt;/SPAN&gt;)
                       &lt;SPAN&gt;oTitleBlock&lt;/SPAN&gt;.&lt;SPAN&gt;SetPromptResultText&lt;/SPAN&gt;(&lt;SPAN&gt;oTextBox&lt;/SPAN&gt;, &lt;SPAN&gt;oText&lt;/SPAN&gt;)
               &lt;SPAN&gt;Next&lt;/SPAN&gt;

               &lt;SPAN&gt;'look at sketched symbols    &lt;/SPAN&gt;
               &lt;SPAN&gt;oSymbols&lt;/SPAN&gt; = &lt;SPAN&gt;oSheet&lt;/SPAN&gt;.&lt;SPAN&gt;SketchedSymbols&lt;/SPAN&gt;
               &lt;SPAN&gt;For&lt;/SPAN&gt; &lt;SPAN&gt;Each&lt;/SPAN&gt; &lt;SPAN&gt;oSymbol&lt;/SPAN&gt; &lt;SPAN&gt;In&lt;/SPAN&gt; &lt;SPAN&gt;oSymbols&lt;/SPAN&gt;
                       &lt;SPAN&gt;For&lt;/SPAN&gt; &lt;SPAN&gt;Each&lt;/SPAN&gt; &lt;SPAN&gt;oTextBox&lt;/SPAN&gt; &lt;SPAN&gt;In&lt;/SPAN&gt; &lt;SPAN&gt;oSymbol&lt;/SPAN&gt;.&lt;SPAN&gt;Definition&lt;/SPAN&gt;.&lt;SPAN&gt;Sketch&lt;/SPAN&gt;.&lt;SPAN&gt;TextBoxes&lt;/SPAN&gt;
                               &lt;SPAN&gt;oText&lt;/SPAN&gt; = &lt;SPAN&gt;oSymbol&lt;/SPAN&gt;.&lt;SPAN&gt;GetResultText&lt;/SPAN&gt;(&lt;SPAN&gt;oTextBox&lt;/SPAN&gt;)
                               &lt;SPAN&gt;oText&lt;/SPAN&gt; = &lt;SPAN&gt;ReplaceText&lt;/SPAN&gt;(&lt;SPAN&gt;oText&lt;/SPAN&gt;, &lt;SPAN&gt;oTXT2Find&lt;/SPAN&gt;, &lt;SPAN&gt;oNewTXT&lt;/SPAN&gt;)
                               &lt;SPAN&gt;oSymbol&lt;/SPAN&gt;.&lt;SPAN&gt;SetPromptResultText&lt;/SPAN&gt;(&lt;SPAN&gt;oTextBox&lt;/SPAN&gt;, &lt;SPAN&gt;oText&lt;/SPAN&gt;)
                       &lt;SPAN&gt;Next&lt;/SPAN&gt;
               &lt;SPAN&gt;Next&lt;/SPAN&gt;
        &lt;SPAN&gt;Next&lt;/SPAN&gt;

&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;Sub&lt;/SPAN&gt;


&lt;SPAN&gt;Function&lt;/SPAN&gt; &lt;SPAN&gt;ReplaceText&lt;/SPAN&gt;(&lt;SPAN&gt;oText&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt;, &lt;SPAN&gt;oTXT2Find&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt;, &lt;SPAN&gt;oNewTXT&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt;)

        &lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;oText&lt;/SPAN&gt; = &lt;SPAN&gt;oTXT2Find&lt;/SPAN&gt; &lt;SPAN&gt;Or&lt;/SPAN&gt; &lt;SPAN&gt;oText&lt;/SPAN&gt;.&lt;SPAN&gt;Contains&lt;/SPAN&gt;(&lt;SPAN&gt;oTXT2Find&lt;/SPAN&gt;) &lt;SPAN&gt;Then&lt;/SPAN&gt;
               &lt;SPAN&gt;oText&lt;/SPAN&gt; = &lt;SPAN&gt;Replace&lt;/SPAN&gt;(&lt;SPAN&gt;oText&lt;/SPAN&gt;, &lt;SPAN&gt;oTXT2Find&lt;/SPAN&gt;, &lt;SPAN&gt;oNewTXT&lt;/SPAN&gt;)
        &lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;
        &lt;SPAN&gt;Return&lt;/SPAN&gt; &lt;SPAN&gt;oText&lt;/SPAN&gt;

&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;Function&lt;/SPAN&gt;
&lt;/PRE&gt;</description>
      <pubDate>Tue, 16 Aug 2022 14:27:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/find-and-replace-text-for-active-sheet/m-p/11362214#M34081</guid>
      <dc:creator>chris_blessing</dc:creator>
      <dc:date>2022-08-16T14:27:40Z</dc:date>
    </item>
    <item>
      <title>Re: find and replace text for active sheet</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/find-and-replace-text-for-active-sheet/m-p/11362268#M34082</link>
      <description>&lt;P&gt;Here you go:&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;Sub Main
	oDrawingDoc = ThisDrawing.Document
	Dim oSheet As Sheet = oDrawingDoc.ActiveSheet
	Dim oGeneralNotes As GeneralNotes
	Dim oGeneralNote As GeneralNote
	Dim oSymbol As SketchedSymbol
	Dim oSymbols As SketchedSymbols
	Dim oTitleBlock As TitleBlock
	Dim oTextBox As TextBox
	
	Dim oTXT2Find As String
	Dim oNewTXT As String

	'get user input
	oTXT2Find = InputBox("Enter Text To Find:", "iLogic", "XXX")
	'look for blank value
	If oTXT2Find = "" Then
		Return 'exit rule
	End If
	
	oNewTXT = InputBox("Enter Text To Replace   '" &amp;amp; oTXT2Find _
	&amp;amp; "'  with.", "iLogic", "ZZZ")
	'look for blank value
	If oNewTXT = "" Then
		Return 'exit rule
	End If

	'handle errors
	On Error Resume Next
	
	'look at General Notes
	oGeneralNotes = oSheet.DrawingNotes.GeneralNotes
	For Each oGeneralNote In oGeneralNotes
		oText = oGeneralNote.FormattedText
		oText = ReplaceText(oText, oTXT2Find, oNewTXT)
		oGeneralNote.FormattedText = oText
	Next

	'look at leader notes 
	oLeaderNotes = oSheet.DrawingNotes.LeaderNotes
	For Each oLeaderNote In oLeaderNotes
		oText = oLeaderNote.FormattedText
		oText = ReplaceText(oText, oTXT2Find, oNewTXT)
		oLeaderNote.FormattedText = oText
	Next

	'look at title blocks
	oTitleBlock = oSheet.TitleBlock
	For Each oTextBox In oTitleBlock.Definition.Sketch.TextBoxes
		oText = oTitleBlock.GetResultText(oTextBox)
		oText = ReplaceText(oText, oTXT2Find, oNewTXT)
		oTitleBlock.SetPromptResultText(oTextBox, oText)
	Next

	'look at sketched symbols    
	oSymbols = oSheet.SketchedSymbols
	For Each oSymbol In oSymbols
		For Each oTextBox In oSymbol.Definition.Sketch.TextBoxes
			oText = oSymbol.GetResultText(oTextBox)
			oText = ReplaceText(oText, oTXT2Find, oNewTXT)
			oSymbol.SetPromptResultText(oTextBox, oText)
		Next
	Next
End Sub


Function ReplaceText(oText As String, oTXT2Find As String, oNewTXT As String)
        If oText = oTXT2Find Or oText.Contains(oTXT2Find) Then
               oText = Replace(oText, oTXT2Find, oNewTXT)
        End If
        Return oText
End Function&lt;/LI-CODE&gt;
&lt;P&gt;If this solved your problem, or answered your question, please click &lt;SPAN&gt;&lt;STRONG&gt;ACCEPT SOLUTION&lt;/STRONG&gt;&lt;/SPAN&gt;.&lt;BR /&gt;Or, if this helped you, please click (LIKE or KUDOS) &lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;.&lt;/P&gt;
&lt;P&gt;If you want and have time, I would appreciate your Vote(s) for &lt;A href="https://forums.autodesk.com/t5/forums/recentpostspage/post-type/message/interaction-style/idea/user-id/7812054/" target="_blank"&gt;My IDEAS &lt;/A&gt; :bulb: or you can Explore &lt;A href="https://knowledge.autodesk.com/profile/LTSUSR7HXMSAE/articles" target="_blank"&gt;My CONTRIBUTIONS &lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Aug 2022 14:44:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/find-and-replace-text-for-active-sheet/m-p/11362268#M34082</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2022-08-16T14:44:40Z</dc:date>
    </item>
    <item>
      <title>Re: find and replace text for active sheet</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/find-and-replace-text-for-active-sheet/m-p/12499312#M34083</link>
      <description>&lt;P&gt;Again my friend&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7812054"&gt;@WCrihfield&lt;/a&gt;&amp;nbsp;you have preformed a miracle.&lt;/P&gt;&lt;P&gt;What a game changer, something so simple but not as standard in inventor.&lt;/P&gt;&lt;P&gt;A quick Question though, is there a way to highlight and conform what is being edited?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards Brian&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jan 2024 11:19:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/find-and-replace-text-for-active-sheet/m-p/12499312#M34083</guid>
      <dc:creator>brianM328K</dc:creator>
      <dc:date>2024-01-16T11:19:20Z</dc:date>
    </item>
    <item>
      <title>Re: find and replace text for active sheet</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/find-and-replace-text-for-active-sheet/m-p/12499709#M34084</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/12855005"&gt;@brianM328K&lt;/a&gt;.&amp;nbsp; I am not sure what you mean.&amp;nbsp; Are you saying that you would like to pause the process and highlight each object just before it edits them, and ask the user if they want this item to be edited?&amp;nbsp; Are you wanting that after all editing has been done, that it will highlight all the stuff that was edited?&amp;nbsp; I am not sure that would be possible.&amp;nbsp; There is a &lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=Document_CreateHighlightSet" target="_blank" rel="noopener"&gt;Document.CreateHighlightSet&lt;/A&gt; method that will create a &lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=GUID-HighlightSet" target="_blank" rel="noopener"&gt;HighlightSet&lt;/A&gt; object, but using them can be finicky.&amp;nbsp; Some types of objects can be added to one of these, and some can not be added to them.&amp;nbsp; If some stuff is inside of a sketch, and some stuff is not, then they may not be able to coexist as visibly highlighted at the same time.&amp;nbsp; The sketch may need to be in edit mode before some stuff within it can be actively highlighted, and may need to remain in edit mode when reviewed by the user.&amp;nbsp; Other stuff that is outside of the sketch may not be available when in edit mode of a specific sketch also.&amp;nbsp; Plus, the highlight effect can sometimes only last momentarily after the code has finished, because sometimes it can easily be interrupted, but other times it stays active pretty well.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jan 2024 14:54:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/find-and-replace-text-for-active-sheet/m-p/12499709#M34084</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2024-01-16T14:54:35Z</dc:date>
    </item>
    <item>
      <title>Re: find and replace text for active sheet</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/find-and-replace-text-for-active-sheet/m-p/12499970#M34085</link>
      <description>&lt;P&gt;Hi Wesley&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In my office it would be beneficial to have the ability to find and replace text in&amp;nbsp;mainly&lt;SPAN&gt;&amp;nbsp;general notes and leader notes.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;For example we might have 10 general notes and 20 leaders all with say "steel" in them but 5 notes and 3 leaders should now say "aluminium". If we could jump to (preferred option) or see each text selection and pick yes or no to confirm the change.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;does that make sense.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jan 2024 16:36:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/find-and-replace-text-for-active-sheet/m-p/12499970#M34085</guid>
      <dc:creator>brianM328K</dc:creator>
      <dc:date>2024-01-16T16:36:01Z</dc:date>
    </item>
    <item>
      <title>Re: find and replace text for active sheet</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/find-and-replace-text-for-active-sheet/m-p/12500001#M34086</link>
      <description>&lt;P&gt;Yes, that makes sense.&amp;nbsp; And I do believe that those objects would highlight just fine.&amp;nbsp; So, I am thinking that you want to first run the rule, then have it prompt you for what text to find, and what test to replace that text with, then do the search, and highlight all of the general notes and leader notes which have the 'search for' text in them.&amp;nbsp; Then show a simple question about if you want to proceed, so you can see all the entities it would be effecting.&amp;nbsp; If you say No, exit the rule, but if you say Yes, loop back through them all, and replace that test as planned.&amp;nbsp; Does that sound about right?&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jan 2024 16:51:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/find-and-replace-text-for-active-sheet/m-p/12500001#M34086</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2024-01-16T16:51:20Z</dc:date>
    </item>
    <item>
      <title>Re: find and replace text for active sheet</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/find-and-replace-text-for-active-sheet/m-p/12500015#M34087</link>
      <description>&lt;P&gt;Hi Wesley&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes something like that thanks. As long as you could pick or deselect the ones you don't want to edit.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards Brian&lt;/P&gt;&lt;P&gt;PS its now 17:00 in the UK so I will have to knock off until 8:00 tomorrow .&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jan 2024 16:57:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/find-and-replace-text-for-active-sheet/m-p/12500015#M34087</guid>
      <dc:creator>brianM328K</dc:creator>
      <dc:date>2024-01-16T16:57:11Z</dc:date>
    </item>
    <item>
      <title>Re: find and replace text for active sheet</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/find-and-replace-text-for-active-sheet/m-p/12500355#M34088</link>
      <description>&lt;P&gt;I am also leaving for the day, but did not get a chance to finish the code I started creating for you.&amp;nbsp; But I will post what I have so far anyways.&amp;nbsp; The requested functionality where you need to be able to manually select/unselect highlighted notes kind of put a halt to my progress, to work on other things, because I know it would take more time to design than I had at the moment.&amp;nbsp; Busy day at work.&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;Sub Main
	If ThisDoc.Document.DocumentType &amp;lt;&amp;gt; DocumentTypeEnum.kDrawingDocumentObject Then Return
	Dim oDDoc As DrawingDocument = ThisDoc.Document
	Dim oSheet As Inventor.Sheet = oDDoc.ActiveSheet
	'&amp;lt;&amp;lt;&amp;lt; set initial values to 'shared' variables &amp;gt;&amp;gt;&amp;gt;
	oGNotes = oSheet.DrawingNotes.GeneralNotes
	oLNotes = oSheet.DrawingNotes.LeaderNotes
	oTO = ThisApplication.TransientObjects
	oHLS = oDDoc.CreateHighlightSet
	oHLS.Color = oTO.CreateColor(255, 0, 0, 1) 'Red - Opaque
	oFoundGNotesColl = oTO.CreateObjectCollection
	oFoundLNotesColl = oTO.CreateObjectCollection
	sFind = ""
	sNew = ""
	'&amp;lt;&amp;lt;&amp;lt; done setting initial values &amp;gt;&amp;gt;&amp;gt;
	'&amp;lt;&amp;lt;&amp;lt; following is a designated marker for a place to jump to later (using GoTo) &amp;gt;&amp;gt;&amp;gt;
	StartOfRepeat :
	'&amp;lt;&amp;lt;&amp;lt; all following code may repeat, so clear the 3 collections &amp;gt;&amp;gt;&amp;gt;
	oHLS.Clear
	oFoundGNotesColl.Clear
	oFoundLNotesColl.Clear
	'&amp;lt;&amp;lt;&amp;lt; get required inputs from user  - exit if nothing entered &amp;gt;&amp;gt;&amp;gt;
	sFind = InputBox("Enter Text To Find.", "Text To Find", "")
	If sFind = "" Then Return
	sNew = InputBox("Enter Replacement Text.", "Replacement Text", "")
	If sNew = "" Then Return
	'&amp;lt;&amp;lt;&amp;lt; conduct searches &amp;gt;&amp;gt;&amp;gt;
	SearchOnly() 'runs the Sub routine defined below Sub Main...End Sub block
	'&amp;lt;&amp;lt;&amp;lt; inspect findings, react appropriately &amp;gt;&amp;gt;&amp;gt;
	If oHLS.Count &amp;gt; 0 Then
		Dim oAns As DialogResult = MessageBox.Show("The highlighted notes contained the text to search for." _
		&amp;amp; vbCrLf &amp;amp; "Do you want to proceed with the replacements? [YES]" _
		&amp;amp; vbCrLf &amp;amp; "Or do you want to remove some of the highlighted objects from the edit group? [NO]" _
		&amp;amp; vbCrLf &amp;amp; "Or do you want to cancel these edits? [CANCEL]", "Matching Notes Found", _
		MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2)
		If oAns = DialogResult.Cancel Then
			GoTo MaybeFinished 'jump to specified location within code
		ElseIf oAns = DialogResult.Yes Then
			'loop back through them and replace the text (simple)
			DoReplacements() 'runs the Sub routine defined below Sub Main...End Sub block
		ElseIf oAns = DialogResult.No Then
			'allow user to manually select ones they want to remove from editing
			'then replace the text in the remaining ones (complex)
			'&amp;lt;&amp;lt;&amp;lt;&amp;lt; !!! NEED TO FINISH CODE HERE !!! &amp;gt;&amp;gt;&amp;gt;&amp;gt;
		End If
	End If
	'&amp;lt;&amp;lt;&amp;lt; following is another marker for a location to jump to (using GoTo) &amp;gt;&amp;gt;&amp;gt;
	MaybeFinished :
	Dim oAgain As DialogResult = MessageBox.Show("Change Search Terms And Go Again? [YES]" _
	&amp;amp; vbCrLf &amp;amp; "Or Exit This Rule? [NO]", "Repeat Rule Process?", MessageBoxButtons.YesNo, _
	MessageBoxIcon.Question, MessageBoxDefaultButton.Button2)
	If oAgain = DialogResult.Yes Then GoTo StartOfRepeat 'jump to specified location within code
End Sub

'declare variables here that all routines will need access to
Dim oGNotes As Inventor.GeneralNotes
Dim oLNotes As Inventor.LeaderNotes
Dim oTO As TransientObjects
Dim oHLS As Inventor.HighlightSet
Dim oFoundGNotesColl As ObjectCollection
Dim oFoundLNotesColl As ObjectCollection
Dim sFind As String
Dim sNew As String

Sub SearchOnly()
	If oGNotes.Count &amp;gt; 0 Then
		For Each oGNote As Inventor.GeneralNote In oGNotes
			If oGNote.FormattedText.Contains(sFind) Then
				oFoundGNotesColl.Add(oGNote)
				oHLS.AddItem(oGNote)
			End If
		Next 'oGNote
	End If
	If oLNotes.Count &amp;gt; 0 Then
		For Each oLNote As Inventor.LeaderNote In oGNotes
			If oLNote.FormattedText.Contains(sFind) Then
				oFoundLNotesColl.Add(oLNote)
				oHLS.AddItem(oLNote)
			End If
		Next 'oLNote
	End If
End Sub

Sub DoReplacements()
	If oFoundGNotesColl.Count &amp;gt; 0 Then
		For Each oGNote As Inventor.GeneralNote In oFoundGNotesColl
			Try : oGNote.FormattedText.Replace(sFind, sNew) : Catch : End Try
			Try : oHLS.Remove(oGNote) : Catch : End Try
		Next 'oGNote
	End If
	If oLNotes.Count &amp;gt; 0 Then
		For Each oLNote As Inventor.LeaderNote In oFoundLNotesColl
			Try : oLNote.FormattedText.Replace(sFind, sNew) : Catch : End Try
			Try : oHLS.Remove(oLNote) : Catch : End Try
		Next 'oLNote
	End If
End Sub&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 16 Jan 2024 20:13:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/find-and-replace-text-for-active-sheet/m-p/12500355#M34088</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2024-01-16T20:13:02Z</dc:date>
    </item>
    <item>
      <title>Re: find and replace text for active sheet</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/find-and-replace-text-for-active-sheet/m-p/12501287#M34089</link>
      <description>Looks good so far.&lt;BR /&gt;Line 75 though 'For Each oLNote As Inventor.LeaderNote In oGNotes'&lt;BR /&gt;you have put 'oGNotes' should this be 'oLNote' ?&lt;BR /&gt;As I have said before I can read the code just don't know how to put it together.&lt;BR /&gt;Brian</description>
      <pubDate>Wed, 17 Jan 2024 07:52:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/find-and-replace-text-for-active-sheet/m-p/12501287#M34089</guid>
      <dc:creator>brianM328K</dc:creator>
      <dc:date>2024-01-17T07:52:30Z</dc:date>
    </item>
    <item>
      <title>Re: find and replace text for active sheet</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/find-and-replace-text-for-active-sheet/m-p/12516263#M34090</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/12855005"&gt;@brianM328K&lt;/a&gt;.&amp;nbsp; Give this variation of the code a try, and let me know how it works for you.&amp;nbsp; I have not tested it yet myself, so if it still does not work as expected, let me know the details of how, and I may be able to adjust it again for you.&amp;nbsp; I attempted to add the extra functionality you wanted...being able to remove some of the drawing notes from the edit group, before it does the replacement.&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;Sub Main
	If ThisDoc.Document.DocumentType &amp;lt;&amp;gt; DocumentTypeEnum.kDrawingDocumentObject Then Return
	Dim oDDoc As DrawingDocument = ThisDoc.Document
	Dim oSheet As Inventor.Sheet = oDDoc.ActiveSheet
	'&amp;lt;&amp;lt;&amp;lt; set initial values to 'shared' variables &amp;gt;&amp;gt;&amp;gt;
	oDNotes = oSheet.DrawingNotes
	oTO = ThisApplication.TransientObjects
	oHLS = oDDoc.CreateHighlightSet
	oHLS.Color = oTO.CreateColor(255, 0, 0, 1) 'Red - Opaque
	oFoundDNotesColl = oTO.CreateObjectCollection
	oDNotesToRemove = oTO.CreateObjectCollection
	sFind = ""
	sNew = ""
	'&amp;lt;&amp;lt;&amp;lt; done setting initial values &amp;gt;&amp;gt;&amp;gt;
	'&amp;lt;&amp;lt;&amp;lt; following is a designated marker for a place to jump to later (using GoTo) &amp;gt;&amp;gt;&amp;gt;
	StartOfRepeat :
	'&amp;lt;&amp;lt;&amp;lt; all following code may repeat, so clear the 3 collections &amp;gt;&amp;gt;&amp;gt;
	oHLS.Clear
	oFoundDNotesColl.Clear
	'&amp;lt;&amp;lt;&amp;lt; get required inputs from user  - exit if nothing entered &amp;gt;&amp;gt;&amp;gt;
	sFind = InputBox("Enter Text To Find.", "Text To Find", "")
	If sFind = "" Then Return
	sNew = InputBox("Enter Replacement Text.", "Replacement Text", "")
	If sNew = "" Then Return
	'&amp;lt;&amp;lt;&amp;lt; conduct searches &amp;gt;&amp;gt;&amp;gt;
	'runs the Sub routine defined below Sub Main...End Sub block
	FindReplace(False) 'False means SearchOnly, no Replace
	'&amp;lt;&amp;lt;&amp;lt; inspect findings, react appropriately &amp;gt;&amp;gt;&amp;gt;
	If oHLS.Count &amp;gt; 0 Then
		Dim oAns As DialogResult = MessageBox.Show("The highlighted notes contained the text to search for." _
		&amp;amp; vbCrLf &amp;amp; "Do you want to proceed with the replacements? [YES]" _
		&amp;amp; vbCrLf &amp;amp; "Or do you want to remove some of the highlighted objects from the edit group? [NO]" _
		&amp;amp; vbCrLf &amp;amp; "Or do you want to cancel these edits? [CANCEL]", "Matching Notes Found", _
		MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2)
		If oAns = DialogResult.Cancel Then
			GoTo MaybeFinished 'jump to specified location within code
		ElseIf oAns = DialogResult.Yes Then
			'loop back through them and replace the text (simple)
			'runs the Sub routine defined below Sub Main...End Sub block
			FindReplace(True) 'True means do Replace process
		ElseIf oAns = DialogResult.No Then
			'allow user to manually select ones they want to remove from editing
			'then replace the text in the remaining ones (complex)
			GetSelected 'runs Sub for user selection
			RemoveSelected 'runs Sub for removing those from edit group
			FindReplace(True) 'runs Replace process on edit group
		End If
	End If
	'&amp;lt;&amp;lt;&amp;lt; following is another marker for a location to jump to (using GoTo) &amp;gt;&amp;gt;&amp;gt;
	MaybeFinished :
	Dim oAgain As DialogResult = MessageBox.Show("Change Search Terms And Go Again? [YES]" _
	&amp;amp; vbCrLf &amp;amp; "Or Exit This Rule? [NO]", "Repeat Rule Process?", MessageBoxButtons.YesNo, _
	MessageBoxIcon.Question, MessageBoxDefaultButton.Button2)
	If oAgain = DialogResult.Yes Then GoTo StartOfRepeat 'jump to specified location within code
End Sub

'declare variables here that all routines will need access to
Dim oDNotes As Inventor.DrawingNotes
Dim oTO As TransientObjects
Dim oHLS As Inventor.HighlightSet
Dim oFoundDNotesColl As ObjectCollection
Dim oDNotesToRemove As ObjectCollection
Dim sFind As String
Dim sNew As String

Sub FindReplace(ByVal bReplace As Boolean)
	If bReplace = False Then
		If oDNotes.Count &amp;gt; 0 Then
			oFoundDNotesColl.Clear
			For Each oDNote As Inventor.DrawingNote In oDNotes
				If oDNote.FormattedText.Contains(sFind) Then
					oFoundDNotesColl.Add(oDNote)
				End If
			Next 'oGNote
			oHLS.Clear
			Try : oHLS.AddMultipleItems(oFoundDNotesColl) : Catch : End Try
		End If
	Else 'bReplace = True
		If oFoundDNotesColl.Count &amp;gt; 0 Then
			For Each oDNote As Inventor.DrawingNote In oFoundDNotesColl
				Try : oDNote.FormattedText.Replace(sFind, sNew) : Catch : End Try
				Try : oFoundDNotesColl.RemoveByObject(oDNote) : Catch : End Try
				Try : oHLS.Remove(oDNote) : Catch : End Try
			Next 'oGNote
		End If
	End If
End Sub

Sub GetSelected()
	oDNotesToRemove.Clear
	Dim oSelDNote As DrawingNote = Nothing
	Do
		oSelDNote = Nothing
		oSelDNote = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingNoteFilter, "Select Note To Remove From Edit Group")
		If oSelDNote Is Nothing Then Exit Do
		oDNotesToRemove.Add(oSelDNote)
	Loop Until oSelDNote Is Nothing
End Sub

Sub RemoveSelected()
	If oDNotesToRemove.Count &amp;gt; 0 Then
		For Each oDNoteToRemove As Inventor.DrawingNote In oDNotesToRemove
			For Each oDNote As Inventor.DrawingNote In oFoundDNotesColl
				If oDNote Is oDNoteToRemove Then
					Try : oFoundDNotesColl.RemoveByObject(oDNote) : Catch : End Try
				End If
			Next 'oDNote
		Next 'oDNoteToRemove
		oHLS.Clear
		Try : oHLS.AddMultipleItems(oFoundDNotesColl) : Catch : End Try
	End If
End Sub&lt;/LI-CODE&gt;
&lt;P&gt;If this solved your problem, or answered your question, please click &lt;SPAN&gt;&lt;STRONG&gt; ACCEPT SOLUTION &lt;/STRONG&gt;&lt;/SPAN&gt;.&lt;BR /&gt;Or, if this helped you, please click (LIKE or KUDOS) &lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jan 2024 19:40:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/find-and-replace-text-for-active-sheet/m-p/12516263#M34090</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2024-01-23T19:40:50Z</dc:date>
    </item>
    <item>
      <title>Re: find and replace text for active sheet</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/find-and-replace-text-for-active-sheet/m-p/12516320#M34091</link>
      <description>&lt;P&gt;I made a couple more minor changes to simplify two routines into one.&amp;nbsp; I attached the resulting code as a text file this time, because of how long these rules are.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jan 2024 20:07:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/find-and-replace-text-for-active-sheet/m-p/12516320#M34091</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2024-01-23T20:07:17Z</dc:date>
    </item>
    <item>
      <title>Re: find and replace text for active sheet</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/find-and-replace-text-for-active-sheet/m-p/12517761#M34092</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/12855005"&gt;@brianM328K&lt;/a&gt;.&amp;nbsp; I should have tested that before posting it, because I see that one line of code in there still needed to be tweaked to make it work.&lt;/P&gt;
&lt;P&gt;The following line of code:&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;Try : oDNote.FormattedText.Replace(sFind, sNew) : Catch : End Try&lt;/LI-CODE&gt;
&lt;P&gt;...should have been like the line below, because you must set a new value to the FormattedText.&amp;nbsp; You can not just directly change its contents, without setting a new value to it.&amp;nbsp; What the line of code above was doing is just retrieving a new String value from the altered contents.&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;Try : oDNote.FormattedText = oDNote.FormattedText.Replace(sFind, sNew) : Catch : End Try&lt;/LI-CODE&gt;
&lt;P&gt;Also, just in case you were not familiar with the way the Pick function works, if you do not want to make a selection while being prompted to, you can just tap the escape key on your keyboard, to exit that command.&amp;nbsp; That action will result in Nothing being returned to the code, instead of a selection, then the code will exit the selection loop, and move on with the rest of the code.&amp;nbsp; I guess we could add some additional text into the selection prompt instructions, telling that detail to the user.&amp;nbsp; To include that extra instruction, we would need to alter the following line of code a bit.&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingNoteFilter, "Select Note To Remove From Edit Group")&lt;/LI-CODE&gt;
&lt;P&gt;The quoted text as the second input into this Pick function is where we specify what text that will be showing in the prompt for the user during selection.&amp;nbsp; Since that line of code is already pretty long, we could change it a bit, and create a String type variable on a line before that line.&amp;nbsp; Set its value with the longer selection prompt/instructions, then use that String type variable as the second input in that line.&amp;nbsp; Sort of like the following.&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;Dim sPrompt As String = "Select Note To Remove From Edit Group." _
&amp;amp; vbCrLf &amp;amp; "To exit selection mode, tap the Escape keyboard key."
oSelDNote = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingNoteFilter, sPrompt)&lt;/LI-CODE&gt;
&lt;P&gt;After changing those two details, I have re-attached the updated code as a text file again.&amp;nbsp; And this time I did conduct some testing, which seemed to be working as planned.&amp;nbsp; Give it a try and let me know how it is working for you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jan 2024 13:22:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/find-and-replace-text-for-active-sheet/m-p/12517761#M34092</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2024-01-24T13:22:37Z</dc:date>
    </item>
    <item>
      <title>Re: find and replace text for active sheet</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/find-and-replace-text-for-active-sheet/m-p/12517829#M34093</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7812054"&gt;@WCrihfield&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This looks like its working great. You are a true god.&lt;/P&gt;&lt;P&gt;I know this has taken up some of your time and I appreciate that thank you.&lt;/P&gt;&lt;P&gt;It bothers me that simple functions like this are not built in as standard.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Thumbs up.png" style="width: 290px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1317852i2F4A02587EB2FF3B/image-dimensions/290x290?v=v2" width="290" height="290" role="button" title="Thumbs up.png" alt="Thumbs up.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jan 2024 13:53:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/find-and-replace-text-for-active-sheet/m-p/12517829#M34093</guid>
      <dc:creator>brianM328K</dc:creator>
      <dc:date>2024-01-24T13:53:08Z</dc:date>
    </item>
    <item>
      <title>Re: find and replace text for active sheet</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/find-and-replace-text-for-active-sheet/m-p/13013998#M34094</link>
      <description>&lt;P&gt;Tanks all, the rule work for me&lt;/P&gt;&lt;P&gt;Exactlly what I expect, and more&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This function have to be in IV vanilla&lt;/P&gt;</description>
      <pubDate>Wed, 11 Sep 2024 13:06:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/find-and-replace-text-for-active-sheet/m-p/13013998#M34094</guid>
      <dc:creator>vianney_cheneau</dc:creator>
      <dc:date>2024-09-11T13:06:15Z</dc:date>
    </item>
    <item>
      <title>Re: find and replace text for active sheet</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/find-and-replace-text-for-active-sheet/m-p/13260483#M34095</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7812054"&gt;@WCrihfield&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can this be modified to search and replace text in a view label?&lt;/P&gt;&lt;P&gt;Nothing fancy, does not need to highlight.&lt;/P&gt;&lt;P&gt;Thx.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jan 2025 17:48:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/find-and-replace-text-for-active-sheet/m-p/13260483#M34095</guid>
      <dc:creator>Vickimcl</dc:creator>
      <dc:date>2025-01-14T17:48:24Z</dc:date>
    </item>
    <item>
      <title>Re: find and replace text for active sheet</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/find-and-replace-text-for-active-sheet/m-p/13260543#M34096</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/447225"&gt;@Vickimcl&lt;/a&gt;.&amp;nbsp; I will post something in a code window below for you to try out.&amp;nbsp; You can modify this as needed.&amp;nbsp; Right now it will first prompt you to pick the drawing view label.&amp;nbsp; Then ask you to enter what test to find.&amp;nbsp; Then it will ask you to enter what to replace that text with.&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;Sub Main
	Dim oInvApp As Inventor.Application = ThisApplication
	Dim oDDoc As DrawingDocument = TryCast(oInvApp.ActiveDocument, Inventor.DrawingDocument)
	If oDDoc Is Nothing Then Return
	Dim oCmdMgr As Inventor.CommandManager = oInvApp.CommandManager
	Dim sPrompt As String = "Select A Drawing View Label - Or Press Esc Key To Exit"
	Dim oViewLabel As DrawingViewLabel = oCmdMgr.Pick(SelectionFilterEnum.kDrawingViewLabelFilter, sPrompt)
	If oViewLabel Is Nothing Then Return
	Dim sFind As String = InputBox("Enter Text To Find.", "To Find", "")
	If sFind = "" Then Return
	Dim sNew As String = InputBox("Enter Text To Replace What Was Found.", "New - Replacement", "")
	Try
		oViewLabel.FormattedText = oViewLabel.FormattedText.Replace(sFind, sNew)
	Catch oEx As Exception
		MsgBox(oEx.ToString)
		'Logger.Error(oEx.ToString)
	End Try
End Sub&lt;/LI-CODE&gt;
&lt;P&gt;And below is another very similar version of this code, but instead of asking you to enter test to find, and text to replace that with, it simply presents you with the current value of its FormattedText, and lets you edit that existing value.&amp;nbsp; Then the edited value gets applied to the drawing view label.&amp;nbsp; A bit simpler way to do something like this, but usually only works good on a single selection basis, rather than iterating through many of them.&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;Sub Main
	Dim oInvApp As Inventor.Application = ThisApplication
	Dim oDDoc As DrawingDocument = TryCast(oInvApp.ActiveDocument, Inventor.DrawingDocument)
	If oDDoc Is Nothing Then Return
	Dim oCmdMgr As Inventor.CommandManager = oInvApp.CommandManager
	Dim sPrompt As String = "Select A Drawing View Label - Or Press Esc Key To Exit"
	Dim oViewLabel As DrawingViewLabel = oCmdMgr.Pick(SelectionFilterEnum.kDrawingViewLabelFilter, sPrompt)
	If oViewLabel Is Nothing Then Return
	Dim sEdited As String = InputBox("Edit current FormattedText as needed.", "Edit Value", oViewLabel.FormattedText)
	Try
		oViewLabel.FormattedText = sEdited
	Catch oEx As Exception
		MsgBox(oEx.ToString)
		'Logger.Error(oEx.ToString)
	End Try
End Sub&lt;/LI-CODE&gt;
&lt;P&gt;If this solved your problem, or answered your question, please click &lt;SPAN&gt;&lt;STRONG&gt; ACCEPT SOLUTION &lt;/STRONG&gt;&lt;/SPAN&gt;.&lt;BR /&gt;Or, if this helped you, please click (LIKE or KUDOS) &lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jan 2025 18:05:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/find-and-replace-text-for-active-sheet/m-p/13260543#M34096</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2025-01-14T18:05:05Z</dc:date>
    </item>
    <item>
      <title>Re: find and replace text for active sheet</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/find-and-replace-text-for-active-sheet/m-p/13260640#M34097</link>
      <description>&lt;P&gt;Thank you!&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7812054"&gt;@WCrihfield&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will see what I can do to modify. I have a lot of view labels with text to replace so having to pick the view label will not save much time.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jan 2025 19:12:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/find-and-replace-text-for-active-sheet/m-p/13260640#M34097</guid>
      <dc:creator>Vickimcl</dc:creator>
      <dc:date>2025-01-14T19:12:55Z</dc:date>
    </item>
    <item>
      <title>Re: find and replace text for active sheet</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/find-and-replace-text-for-active-sheet/m-p/13260732#M34098</link>
      <description>&lt;P&gt;Sorry, been super busy at work lately, so less time to help others online with custom, complex Inventor automation solutions.&amp;nbsp; The text file in my earlier post contained pretty complex code, so I did not want to recreate all of that for a different type of object, that is not obtained the same way, so no simple/easy change to make it happen.&amp;nbsp; Try code below instead.&amp;nbsp; It asks for the 'Find' &amp;amp; 'New' up front, then will iterate all views on active sheet.&amp;nbsp; If label not visible, then it will skip it.&amp;nbsp; Have 2 Try/Catch statements, both with two options for feedback, if any (Msg or iLogic Log entry), with Msg active right now, but you can change that, if annoying.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;On my way out for the day right now, so I may check back tomorrow, if not swamped then also.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;Sub Main
	Dim oInvApp As Inventor.Application = ThisApplication
	Dim oDDoc As DrawingDocument = TryCast(oInvApp.ActiveDocument, Inventor.DrawingDocument)
	If oDDoc Is Nothing Then Return
	Dim oSheet As Inventor.Sheet = oDDoc.ActiveSheet
	Dim oViews As DrawingViews = oSheet.DrawingViews
	If oViews.Count = 0 Then Return
	Dim sFind As String = InputBox("Enter Text To Find.", "To Find", "")
	If sFind = "" Then Return
	Dim sNew As String = InputBox("Enter Text To Replace Is Found.", "New - Replacement", "")
	For Each oView As DrawingView In oViews
		If Not oView.ShowLabel Then Continue For 'skip it if not visible
		Dim oLabel As DrawingViewLabel = oView.Label
		Dim sFText As String = oLabel.FormattedText
		If Not sFText.Contains(sFind) Then Continue For 'skip if does not contain text to replace
		Dim bChanged As Boolean = False
		Try
			sFText = sFText.Replace(sFind, sNew)
			bChanged = True
		Catch oEx As Exception
			MsgBox(oEx.ToString)
			'Logger.Error(oEx.ToString)
		End Try
		If Not bChanged Then Continue For
		Try
			oLabel.FormattedText = sFText
		Catch oEx As Exception
			MsgBox(oEx.ToString)
			'Logger.Error(oEx.ToString)
		End Try
	Next oView
End Sub&lt;/LI-CODE&gt;
&lt;P&gt;If this solved your problem, or answered your question, please click &lt;SPAN&gt;&lt;STRONG&gt; ACCEPT SOLUTION &lt;/STRONG&gt;&lt;/SPAN&gt;.&lt;BR /&gt;Or, if this helped you, please click (LIKE or KUDOS) &lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jan 2025 20:07:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/find-and-replace-text-for-active-sheet/m-p/13260732#M34098</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2025-01-14T20:07:48Z</dc:date>
    </item>
    <item>
      <title>Re: find and replace text for active sheet</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/find-and-replace-text-for-active-sheet/m-p/13260742#M34099</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7812054"&gt;@WCrihfield&lt;/a&gt;&amp;nbsp;you are the best! Works perfectly.&lt;/P&gt;&lt;P&gt;I was still working on the code, not even close (..still learning).&lt;/P&gt;&lt;P&gt;This will save me tons of time, much appreciated.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jan 2025 20:14:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/find-and-replace-text-for-active-sheet/m-p/13260742#M34099</guid>
      <dc:creator>Vickimcl</dc:creator>
      <dc:date>2025-01-14T20:14:47Z</dc:date>
    </item>
    <item>
      <title>Re: find and replace text for active sheet</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/find-and-replace-text-for-active-sheet/m-p/13608024#M34100</link>
      <description>&lt;P&gt;You, my friend, are a genius!!&lt;/P&gt;&lt;P&gt;This has come in very handy and has already saved me hours of work.&lt;/P&gt;&lt;P&gt;Thank you very much!&lt;/P&gt;</description>
      <pubDate>Wed, 30 Apr 2025 16:50:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/find-and-replace-text-for-active-sheet/m-p/13608024#M34100</guid>
      <dc:creator>jlarose</dc:creator>
      <dc:date>2025-04-30T16:50:17Z</dc:date>
    </item>
  </channel>
</rss>

