28 | 04 | 2017

Change Text in a Block

Function to replace a text in a Block

Code:

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
Login

Sign up now and upload your code to the website.

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