Community
Hello community!
I have question regarding the VBA Enabler add-in for AutoCAD 2017. Does anyone know of a way to extract the name of an image using VBA after a user double clicks that particular image? Any ideas/insight on this odd request would be much appreciated.
Regards,
By "image", I assume you mean raster image inserted into AutoCAD drawing. Finding raster image's file name programmatically is not an odd thing to do, Rather, it is quite simple. Following VBA code shows the file name of an image when user selects it:
Public Sub GetImageFileName() Dim ent As AcadEntity Dim pt As Variant Dim image As AcadRasterImage ThisDrawing.Utility.GetEntity ent, pt, vbCr & "Select a raster image:" If ent Is Nothing Then Exit Sub If TypeOf ent Is AcadRasterImage Then Set image = ent MsgBox "Image file name: " & image.ImageFile End If End Sub
Norman Yuan