adds Posté(e) le 21 août 2023 Posté(e) le 21 août 2023 Voici une ilogic pour faire le taf Sub main oDoc = ThisDoc.Document Dim oSheets As Sheets Dim oSheet As Sheet 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 ooTXT2Find 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 '" & oTXT2Find _ & "' with.", "iLogic", "ZZZ") 'look for blank value If oNewTXT = "" Then Return 'exit rule End If oSheets = oDoc.Sheets For Each oSheet In oSheets '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 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
Messages recommandés
Créer un compte ou se connecter pour commenter
Vous devez être membre afin de pouvoir déposer un commentaire
Créer un compte
Créez un compte sur notre communauté. C’est facile !
Créer un nouveau compteSe connecter
Vous avez déjà un compte ? Connectez-vous ici.
Connectez-vous maintenant