Set Document Data Source To Relative Paths

Created:12/6/2001
Description:

One property of an ArcMap or 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. Copy and paste the following code into an ArcScene VBA session and call the macro 'SetDocumentDataSourceToRelativePaths'.
'
'   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
            
  ElseIf TypeOf Application.Document Is IMxDocument Then
    Dim pMxDoc As IMxDocument
    Set pMxDoc = Application.Document
    pMxDoc.RelativePaths = True
  End If
    
  Exit Sub
        
SetDocumentDataAsRelativePaths:
  Debug.Print "SetDocumentDataAsRelativePaths: " &  Err.Description
  Debug.Assert 0
        
End Sub