How to set document data sources to relative paths


One property of an ArcScene document is whether the layers in the document are stored as relative to the document location (ie. .\Data\Roads.shp) or as a full path (ie. d:\data\Roads.shp). This macro will automatically set this data source property to 'Relative Paths'.

How to use

  1. Paste the code into an ArcScene VBA session and call the macro 'SetDocumentDataSourceToRelativePaths'.
[VBA]
'
'   set the document data source to "relative paths"
'

Public Sub SetDocumentDataSourceToRelativePaths()
    
    On Error GoTo SetDocumentDataAsRelativePaths
    If TypeOf Application.Document Is ISxDocument Then
        Dim pSxDoc As ISxDocument
        Set pSxDoc = Application.Document
        pSxDoc.RelativePaths = True
    End If
    
    Exit Sub
    
SetDocumentDataAsRelativePaths:
    Debug.Print "SetDocumentDataAsRelativePaths: " & Err.Description
    Debug.Assert 0
    
End Sub