how to find and replace text in multiple files from autocad in vb.net?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have an error in this code
OpenFileDialog1.Filter = "(Autocad 2008 Files)|*.dwg"
OpenFileDialog1.Multiselect = True
Dim success As Boolean = False
Dim oAcadDoc As AcadDocument
Dim oSS As AcadSelectionSet = Nothing
Dim oAutocad As AcadApplication = New AcadApplication
Dim bRefObj As AcadBlockReference
Dim entObj As AcadEntity
Dim bRefVar As Object
Dim sText As String
On Error Resume Next
oAutocad.Visible = False
oAutocad.WindowState = AcWindowState.acMax
oAutocad.Application.Documents.Open("C:\Users\pc\Desktop\test\sd\r\5).dwg")
oAcadDoc = Nothing
For Each entObj In oAcadDoc.PaperSpace
If entObj.ObjectName = "AcadBlockReference" Then
bRefObj = entObj
With oAcadDoc.Utility
If bRefObj.HasAttributes Then
bRefVar = bRefObj.GetAttributes
For intI = LBound(bRefVar) To UBound(bRefVar)
sText = bRefVar(intI).TextString
If sText = "CORPORATE CONSTRUCTION" Then
bRefVar(intI).TextString = "DILLING MECHANICAL"
End If
Next
End If
End With
End If
Next
For Each entObj In oAcadDoc.PaperSpace
If entObj.ObjectName = "AcDbText" Then
If entObj.TextString = "CORPORATE CONSTRUCTION" Then
entObj.TextString = "DILLING MECHANICAL"
End If
End If
Next
please help me!