20 | 09 | 2017

Change Text in a Block

Function to replace a text in a Block


Public Function ChangeTextinBlock(ByVal OldText As String, ByVal NewText As String)

'******* Code from VisibleVisual.com ***************
'******* Searches text in Block and changes it *****
Dim i As Integer
Dim z As Integer
Dim BlkText As String
For i = 0 To ThisDrawing.Blocks.Count - 1
    For z = 0 To ThisDrawing.Blocks.Item(i).Count - 1
        BlkText = ""
        On Error Resume Next
        BlkText = ThisDrawing.Blocks.Item(i).Item(z).TextString
        If BlkText Like OldText Then
        ThisDrawing.Blocks.Item(i).Item(z).TextString = NewText
        End If
    Next z
Next i
ThisDrawing.Regen acAllViewports
End Function

Sign up now and upload your code to the website.

Help us to continue.....
Articles View Hits
Latest Articles