Changing multiple references

If I have a large amount of .dgn files which have a reference attached, located say for example in "C:\REFONE". Is there a batch process or an automated way I can change the reference in all the files to "C:\REFTWO" ?

Directories are made up, I just want to know if i can change all the existing ref directories for another.

  • Hi,

    I've used this routine in the past to fix some of my drawings:

    Sub ReferenceNameReplace()
        Dim oldString As String
        Dim newString As String
        Dim OldFileName As String
        oldString = "Details11"
        newString = "Details13"
        For Each AttachedFile In ActiveModelReference.Attachments
            OldFileName = AttachedFile.AttachName
            If Left(OldFileName, Len(oldString)) = oldString Then
                NewAttachmentName = newString & Right(OldFileName, Len(OldFileName) - Len(oldString))
                AttachedFile.SetAttachNameDeferred NewAttachmentName
            End If
    End Sub

    In your case, the old string is the old path and the new string is either the new path or a configuration variable and a colon.  You could use a batch command to run this on each file (vba run ReferenceNameReplace), or you could continue it in vba and have vba open each file and then run the command.

    Please note that I am using SetAttachedNameDEFERRED, which means that the new file will not show up until the drawing is re-opened.  If you're doing this on multiple files, it will save time not loading up the new file.


  • We need the old DOS ref tool.

    Ustn since 1988
    SS4 - i7-3.45Ghz-16 Gb-250/1Tb/1Tb-Win8.1-64b

    Eric D. Milberger
    Architect + Master Planner + BIM

    Senior  Master Planner NASA - Marshall Space Flight Center

    The Milberger Architectural Group, llc

Reply Children
No Data