Trying to get parentdevdir name of Reference attachments attached with relative path

Hi all,

I'm working on a macro where I want to be able to modify the attachname of certain reference attachments. Our configuration is set to bring in attachments using save relative path but my code needs to be able to determine what the value of parentdevdir for each of my reference attachments is but I am unsure how I can do this. Can anyone suggest how I can achieve this?

Thanks

  • Unknown said:
    My code needs to be able to determine the value of parentdevdir for each of my reference attachments

    Add a VBA reference to the Windows Scripting Runtime DLL.  Scripting Runtime provides the invaluable FileSytemObject (FSO).

    The FSO gives you what you need to work with files and folders.  The File object has methods to extract bits of a file path and reassemble them.  Our article provides some examples.  You'll find more on Microsoft news groups.

     
    Regards, Jon Summers
    LA Solutions

  • Morning Jon,

    I've used the FSO in other macro's though I'm not sure how it helps with reference attachments. My experience using FSO is limited to me specifically coding a file name and path (e.g. writing to a text file) whereas in my current macro project I am using ref attachments. Do you have and example snippet how FSO can be used with get the path of attachments that have a relative path?

    I have since found that the path property (oAtt.activedesignfile.path iirc)  will give me what I need but it will be useful to learn alternative methods.

    Cheers

  • The FSO is useful because of the other classes that come with it: Folder and File.  You use those to parse bits of a path.

    Folder , for example, has method ParentFolder.  So you can apply that to your active design file path to obtain its parent.  Do that for each ..\ in your attachment path to reach the common root for design files and references.

     
    Regards, Jon Summers
    LA Solutions

  • I managed to complete this Macro and its been working great until this afternoon and I found the strangest glitch and I was wondering why it was happening. My Macro evaluates the reference attachment's parent folder and its path and prefixes the attachname with one of our custom project specific variables (depending on what the folder location is). The glitch I have found is that when I use True Hidden Line from Set Reference Presentation, the macro fails to alter the attachments attachname, untick this and the macro works. Its not really an issue but I'm just curious why this is happening?