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 HelpsFullFileName = ActiveDesignFile.Path & "\" & "Test.dgn"
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, "\"))
Mike Longstreet said:Is there some way to get the path to the parent folder. I attempted something like ActiveDesignFile.ParentFolder
Use Microsoft's freeware Scripting Runtime library, which supplies the File System Object (FSO). It's probably already installed on your computer. All you have to do is reference it in your VBA project.
The FSO provides the File and Folder objects. They provide what you need. There are plenty of examples of the FSO on the web.
Regards, Jon Summers LA Solutions
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 LongstreetVermont Agency of TransportationCivil Engineering Technical SupportVTCAD Help
Ok I will check out the FSO library. It may have a more direct method for using the name of a folder within my process.
Here's Microsoft's help on Using Folder Properties. The Folder.ParentFolder property looks like just what you need.