<?xml encoding=”UTF-8″>By Adam Nagy
If an image file was inserted into a drawing’s title block with the “LINK” option and the file got moved or deleted, then when you try to edit the title block definition you get this dialog:
You can remove those images programmatically as well. Here is a VBA code that does this:
Sub DeleteSketchImage()
Dim dwg As DrawingDocument
Set dwg = ThisApplication.ActiveDocument
Dim s As Sheet
Set s = dwg.ActiveSheet
Dim tbd As TitleBlockDefinition
Set tbd = dwg.TitleBlockDefinitions("ANSI - Large")
' This is to avoid any dialog popping up
ThisApplication.SilentOperation = True
Dim sk As DrawingSketch
Call tbd.Edit(sk)
Dim si As SketchImage
Set si = sk.SketchImages(1)
If si.LinkedToFile Then
Dim fso As Object
Set fso = ThisApplication.FileManager.FileSystemObject
If Not fso.FileExists(si.Name) Then
Call si.Delete
End If
End If
Call tbd.ExitEdit(True)
ThisApplication.SilentOperation = False
End Sub


Leave a Reply