Parent folder path of ActiveDesignFile.

Is there some way to get the path to the parent folder. I attempted something like ActiveDesignFile.ParentFolder, but that does not work. 

If an active design file is located in a folder:
C:\Projects\12345\Resource\test.dgn  

And I would like to attach a file referece from:
C:\Projects\12345\Survey\    is there some way to jump up one to parent folder.  .\ 

Path = .\Surey\  ??

Example in MSVBA Help
sFullFileName = ActiveDesignFile.Path & "\" & "Test.dgn"

Parents
  • Hi,

    There are a couple things you could do, depending on what you're doing.  

    1) If you command accepts relative paths then int would be "..\Survey\Test.dgn"

    2) If you need a full path, then you could use the Reverse InString command...

    Parent Folder = Left(ActiveDesignFile.Path, InStrRev(ActiveDesignFile.Path, "\"))

    --Robert

Reply
  • Hi,

    There are a couple things you could do, depending on what you're doing.  

    1) If you command accepts relative paths then int would be "..\Survey\Test.dgn"

    2) If you need a full path, then you could use the Reverse InString command...

    Parent Folder = Left(ActiveDesignFile.Path, InStrRev(ActiveDesignFile.Path, "\"))

    --Robert

Children
  • Thanks I was able to use both suggestion 1) & 2).  

        myDGNpath = ActiveDesignFile.Path
        myDGN = ActiveDesignFile.Name
        pinPath = Left(ActiveDesignFile.Path, InStrRev(ActiveDesignFile.Path, "\"))
        pinNumV = Right(pinPath, 7)
        pinNum = Left(pinNumV, 6)
        
        attsvName = "..\Survey\x" & (pinNum) & "sv.dgn"
       
        Set attsv = ActiveModelReference.Attachments.AddCoincident1(attsvName, _
                        vbNullString, "SV", "True Scale World", _
                        msdAddAttachmentElementsVisible Or msdAddAttachmentFlagTrueScale Or msdAddAttachmentFlagCoincidentWorld)

    Mike Longstreet
    Vermont Agency of Transportation
    Civil Engineering Technical Support
    VTCAD Help