LoadShapeFile Method (ActiveX)

Loads a shape file (SHX).

Supported platforms: Windows only

Signature

VBA:

object.LoadShapeFile FullName
object

Type: Document

The object this method applies to.

FullName

Access: Input-only

Type: String

The full path and name of the shape file to load.

Return Value (RetVal)

No return value.

Remarks

This method makes all the shapes in the shape file available to the current drawing. To add a shape into the drawing, use the AddShape method.

You must load a shape file the first time you need it. AutoCAD loads it thereafter. The shape file must be available each time you edit the drawing.

Examples

VBA:

Sub Example_LoadShapeFile()
    ' This example loads a shape file
    
    Dim shapeFileToLoad As String
    shapeFileToLoad = "C:/AutoCAD/Support/ltypeshp.shx"
    
    ' Load the shape file
    On Error GoTo ERRORHANDLE
    ThisDrawing.LoadShapeFile shapeFileToLoad
    Exit Sub
ERRORHANDLE:
    MsgBox Err.Description, Title:="LoadShapeFile"
    
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_LoadShapeFile()
    ;; This example loads a shape file
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
  
    (setq shapeFileToLoad (findfile "ltypeshp.shx"))
    
    ;; Load the shape file
    (vla-LoadShapeFile doc shapeFileToLoad)
)