Xiaodong,
How would I change the following code to include a second .ipt in the replace reference routine?
I have a part 485000-001 and 485000-002. I can successfully replace the reference of the 485000-001 but, cannot replace the 485000-002.
Could you assist with this?
Sub SAVEDETAIL (ByVal TemplateDrawing As String, ByVal PLAINPN As String, ByVal PNWSUFFIX As String, ByVal PTASSYPN As String, ByVal filePath As String)
DESTINATIONDOC = ThisApplication.DOCUMENTS.Open(TemplateDrawing, False)
DESTINATIONDOC.SAVEAS(filePath & PLAINPN & ".idw", False)
Dim STRNEWREFNAME As String
Dim OREFFILE As FILEDESCRIPTOR
For Each OREFFILE In DESTINATIONDOC.FILE.REFERENCEDFILEDESCRIPTORS
Dim OORIGREFNAME As String
OORIGREFNAME = OREFFILE.FULLFILENAME
If OORIGREFNAME.EndsWith(".ipt") Then
STRNEWREFNAME = filePath & PNWSUFFIX & ".ipt"
OREFFILE.REPLACEREFERENCE(STRNEWREFNAME)
ElseIf OORIGREFNAME.EndsWith(".iam") Then
STRNEWREFNAME = filePath & PTASSYPN & ".iam"
OREFFILE.REPLACEREFERENCE(STRNEWREFNAME)
End If
Exit For
Next
DESTINATIONDOC.Update()
DESTINATIONDOC.Save
DESTINATIONDOC.Close
End Sub